Discuss Scratch

JplaysStuff
Scratcher
100+ posts

Significantly worse performance when running projects on Firefox

My browser / operating system: Windows NT 10.0, Firefox 105.0
Intel Core i5-12400
16 GB RAM
NVIDIA GeForce GTX 1650

It seems that when running a Scratch project with the Firefox browser, the project runs at around 20 FPS, vs. the target 30 FPS. Browsers like Edge and Google Chrome run at 30 just fine, but Firefox seems to hover at around 20-22. Enabling or disabling hardware acceleration doesn't seem to make a difference. I've also tried this on multiple devices, and the results are the same, with Firefox having worse performance, even with specs that should be more than capable of reaching Scratch's target framerate.

Is this some sort of strange bug, or does Firefox have a limitation that causes this performance dip with Scratch?

p.s. yes i know almost nobody uses firefox anymore, but it's still a weird performance issue
TheGlassPenguin
Scratcher
1000+ posts

Significantly worse performance when running projects on Firefox

It's been known for a while that Firefox has issues with performance. It's an issue with Scratch itself (according to this Firefox bug report). I also want to try if this affects TurboWarp or Forkphorus, but i need sleep lol

also yes people actually use firefox
JplaysStuff
Scratcher
100+ posts

Significantly worse performance when running projects on Firefox

TheGlassPenguin wrote:

It's been known for a while that Firefox has issues with performance. It's an issue with Scratch itself (according to this Firefox bug report). I also want to try if this affects TurboWarp or Forkphorus, but i need sleep lol

also yes people actually use firefox

Yeah, that seems about right. It's a shame, since Firefox is my daily driver, but it is what it is… hopefully this gets looked into further sooner or later.
Prince_Wolf1
Scratcher
1000+ posts

Significantly worse performance when running projects on Firefox

FireFox is slow for me for everything
Maybe it’s just the browser?

Last edited by Prince_Wolf1 (Sept. 30, 2022 21:24:05)

captainupantsyay
New Scratcher
1 post

Significantly worse performance when running projects on Firefox

Prince_Wolf1 wrote:

FireFox is slow for me for everything
Maybe it’s just the browser?

That just sounds like you have a bad pc/laptop, I daily drive firefox with no speed issues.
CST1229
Scratcher
1000+ posts

Significantly worse performance when running projects on Firefox

I once experimented with finding a fix for this. I made the runtime use JavaScript's requestAnimationFrame function instead of setInterval to time frames, and it went from ~21FPS to ~30FPS for me (though I implemented it as a userscript so I sadly can't share it here).
redspacecat
Scratcher
500+ posts

Significantly worse performance when running projects on Firefox

CST1229 wrote:

I once experimented with finding a fix for this. I made the runtime use JavaScript's requestAnimationFrame function instead of setInterval to time frames, and it went from ~21FPS to ~30FPS for me (though I implemented it as a userscript so I sadly can't share it here).
Oh I really want to use that… I'm not sure how to make something like that…
redspacecat
Scratcher
500+ posts

Significantly worse performance when running projects on Firefox

bump because this is a major issue
Catzcute4
Scratcher
500+ posts

Significantly worse performance when running projects on Firefox

redspacecat wrote:

CST1229 wrote:

I once experimented with finding a fix for this. I made the runtime use JavaScript's requestAnimationFrame function instead of setInterval to time frames, and it went from ~21FPS to ~30FPS for me (though I implemented it as a userscript so I sadly can't share it here).
Oh I really want to use that… I'm not sure how to make something like that…
i think he set the variable requestAnimationFrame to run the setInterval function with the time at 30
redspacecat
Scratcher
500+ posts

Significantly worse performance when running projects on Firefox

Catzcute4 wrote:

redspacecat wrote:

CST1229 wrote:

I once experimented with finding a fix for this. I made the runtime use JavaScript's requestAnimationFrame function instead of setInterval to time frames, and it went from ~21FPS to ~30FPS for me (though I implemented it as a userscript so I sadly can't share it here).
Oh I really want to use that… I'm not sure how to make something like that…
i think he set the variable requestAnimationFrame to run the setInterval function with the time at 30
I tried that, I couldn't figure it out.
10goto10
Scratcher
1000+ posts

Significantly worse performance when running projects on Firefox

My browser / operating system: Windows NT 10.0, Firefox 134.0, No Flash version detected

I've noticed this for years. My case study is here: https://scratch.mit.edu/projects/446446960
This Scratch pitfall is #15 in my studio of Scratch programming pitfalls.

I've had people say it's my fault for changing some Firefox parameter but I've never changed anything. Those people have never stated their platform or firefox version information.

The Scratch Github bug report is here: https://github.com/scratchfoundation/scratch-vm/issues/3715 . It is still an open issue.

A Scratch developer commented (back in 2022) that using “Firefox Developer Edition v105.0b2, I got a pretty consistent 30 fps” but got 22 in the regular version.



BrodysWorld
Scratcher
7 posts

Significantly worse performance when running projects on Firefox

Replacing ‘setInterval’ with ‘requestAnimationFrame’ in Scratch's code fixes this issue and I'm pretty sure Turbowarp already defaults to doing this but if you don't wanna run every single project in TurboWarp, it's heavy coding needs that the average Scratch user probably wouldn't want to do, especially when the alternative is just switching to a browser like Chrome for whenever you are using Scratch.

Firefox says it's Scratch's problem but it's both of theirs. Scratch has an unusual way of rendering their projects, so it can be blamed on Scratch. But it can also be blamed on Firefox for not adapting to this odd way of rendering, as other browsers have.

I hope a Scratch Addon that fixes this issue is made soon.
BrodysWorld
Scratcher
7 posts

Significantly worse performance when running projects on Firefox

captainupantsyay wrote:

Prince_Wolf1 wrote:

FireFox is slow for me for everything
Maybe it’s just the browser?

Nah its Scratch being different than other websites. If you tested on your PC it might be like ‘Firefox normal: 20FPS’ ‘Scratch projects: 8 FPS’
CST1229
Scratcher
1000+ posts

Significantly worse performance when running projects on Firefox

BrodysWorld wrote:

(#12)
Replacing ‘setInterval’ with ‘requestAnimationFrame’ in Scratch's code fixes this issue and I'm pretty sure Turbowarp already defaults to doing this
It doesn't (except in “0” FPS mode but that locks the framerate to the monitor's refresh rate).

Last edited by CST1229 (April 6, 2025 18:15:22)

NhanTNT
Scratcher
5 posts

Significantly worse performance when running projects on Firefox

Anyways, does anyone has a quick fix so that I don't have to see my FPS staying at 21 every single time?
BigNate469
Scratcher
1000+ posts

Significantly worse performance when running projects on Firefox

NhanTNT wrote:

Anyways, does anyone has a quick fix so that I don't have to see my FPS staying at 21 every single time?
Yeah. Use a different browser.

Yes, I'm being serious. Go use Chrome or something.

Powered by DjangoBB