Skip to main content
tnbnicer
Inspiring
March 29, 2019
Answered

Firefox and frame rate question

  • March 29, 2019
  • 1 reply
  • 2641 views

Hi.

Through much testing and trial and error I have come to the conclusion that Firefox browsers, from about version 50 onwards, throttle the frame rate. It appears to be a deliberate feature. The frame rate that is set is lowered, usually by a factor of 0.7 to 0.8. 30 fps dips down to 24, 80 fps down to 64, etc.

The frame rate is being throttled. Launching a separate process that requires GPU resources, whether it is in the same browser (opening a new tab), or a different browser (Edge or Chrome running an animation at the same time), or any 2D graphics application, increases the animation frame rate in Firefox to approximately the set frame rate. 30 = 30. 80 = 80.

Tests on two Windows 10 desktop PCs, and a Windows 7. The most recent Firefox version to implement the set frame rate was FF 47.

I tried alternate timing modes, RAF and RAF_SYNCHED -- to no avail.

Does anyone know a solution? I am tempted to raise the frame rate applied only to Firefox.

This topic has been closed for replies.
Correct answer tnbnicer

Okay, I've done some more thinking and testing. The code above, using RAF_SYNCHED, approximates most closely the behavior of other browsers. Par for course perhaps. The frame rates that work best are divisors of 60. 30, 20, 12. Edge and Chrome don't like the switch, so you need a conditional statement and a code to detect Firefox. Example:

var ff=(('netscape' in window) && / rv:/.test(navigator.userAgent))?1:-1;

if (ff != -1) createjs.Ticker.timingMode = createjs.Ticker.RAF_SYNCHED;

I don't know precisely in what version FPS throttling became a feature. (The change must have been around the version FF dropped NPAPI.) The version may be irrelevant, since older versions evidently ignore RAF_SYNCHED. (Ticker.timingMode stays at default?) I'm checking on the browser version to be on the safe side. I think it doesn't matter. If there's no further post from me, consider it the best I could do. That is, you don't need to worry about the FF version. Older FF browsers work fine.

1 reply

tnbnicer
tnbnicerAuthor
Inspiring
March 29, 2019

createjs.Ticker.timingMode = createjs.Ticker.RAF;

createjs.Ticker.setFPS(lib.properties.fps);

Sets the frame rate at 60 always.

createjs.Ticker.timingMode = createjs.Ticker.RAF_SYNCHED;

createjs.Ticker.setFPS(lib.properties.fps);

Frame rates stutter too much and 60 fps is the maximum.

tnbnicer
tnbnicerAuthorCorrect answer
Inspiring
March 29, 2019

Okay, I've done some more thinking and testing. The code above, using RAF_SYNCHED, approximates most closely the behavior of other browsers. Par for course perhaps. The frame rates that work best are divisors of 60. 30, 20, 12. Edge and Chrome don't like the switch, so you need a conditional statement and a code to detect Firefox. Example:

var ff=(('netscape' in window) && / rv:/.test(navigator.userAgent))?1:-1;

if (ff != -1) createjs.Ticker.timingMode = createjs.Ticker.RAF_SYNCHED;

I don't know precisely in what version FPS throttling became a feature. (The change must have been around the version FF dropped NPAPI.) The version may be irrelevant, since older versions evidently ignore RAF_SYNCHED. (Ticker.timingMode stays at default?) I'm checking on the browser version to be on the safe side. I think it doesn't matter. If there's no further post from me, consider it the best I could do. That is, you don't need to worry about the FF version. Older FF browsers work fine.

tnbnicer
tnbnicerAuthor
Inspiring
March 30, 2019
TargetActualTargetActualTargetActualTargetActual
1211262140325433
1313272141325533
1413282142325633
1513292143325733
1616302144325833
1716312245325933
1816323246326033
1916333247326133
2016343248326233
2119353249336333
2221363250336463
2321373251336563
2421383252338064
252139325333

Firefox targets specific frame rates. 13, 16, 22, 32, 64. Other frame rates are throttled back in the browser. When GPU resources allow, the throttled frame rates can go up to the targeted frame rates.

This list was made based on Windows 10 tests. It does not represent a reliable guide for Firefox behavior on Mac and Linux, but I believe it is fairly true on Windows.

So far I haven't determined with which version of Firefox throttling frame rates was introduced. I will append that information, if I can.