Open
Bug 828189
Opened 12 years ago
Updated 8 months ago
mozRequestAnimationFrame doesn't tick very precisely in Firefox 18
Categories
(Core :: Layout, defect)
Tracking
()
NEW
People
(Reporter: bernhard.robert.pichler, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11
Steps to reproduce:
mozRequestAnimationFrame(onFrame);
function onFrame(t) {
console.log(t);
mozRequestAnimationFrame(onFrame)
}
Actual results:
[10:53:16.183] 1357725196183
[10:53:16.190] 1357725196190
[10:53:16.220] 1357725196220
[10:53:16.221] 1357725196221
[10:53:16.240] 1357725196240
[10:53:16.248] 1357725196248
[10:53:16.262] 1357725196262
[10:53:16.278] 1357725196278
[10:53:16.305] 1357725196305
Expected results:
The times logged to the console should have a delta of ~16-17 ms on my 60Hz screen. But in fact they have a delta ranging from 1ms to 30ms. Therefore all animations look very bad.
Comment 1•12 years ago
|
||
Can you please attach a full testcase and not only a snippet ?
Reporter | ||
Comment 2•12 years ago
|
||
The snippet is the full test, there is nothing else. Of course you will use mozRequestAnimationFrame in a real web-app in combination with canvas or something like similar. Here is the code on jsfiddle:
http://jsfiddle.net/49YD8/
You can look at a "real world" example and how awful it looks compared to Chrome or IE9 here:
http://www.dartflash.com/demos/performance/performance.html
The JavaScript of this example is compiled from another language, so don't be surprised. But the root of all problems is the code snipped above.
Updated•12 years ago
|
Component: Untriaged → Layout
Product: Firefox → Core
![]() |
||
Comment 3•12 years ago
|
||
Is this specific to 18, or are you seeing the same behavior in 17?
If you see the same behavior, I suggest you try a nightly build with bug 731974 fixed.
![]() |
||
Updated•12 years ago
|
Summary: mozRequestAnimationFrame broken in Firefox 18 → mozRequestAnimationFrame doesn't tick very precisely in Firefox 18
Reporter | ||
Comment 4•12 years ago
|
||
I don't have Firefox 17 on any PC anymore, so i can't test it. But i can say that i didn't noticed problems with mozRequestAnimationFrame on Firefox before. If there was an issue before, then it was definitely not as bad as it is now.
Flags: needinfo?(bernhard.robert.pichler)
(In reply to bernhard.robert.pichler from comment #4)
> I don't have Firefox 17 on any PC anymore, so i can't test it.
All the old versions are available here: http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/
Just select your OS and language.
![]() |
||
Comment 6•12 years ago
|
||
The reason I ask is that I'm not aware of any changes in requestAnimationFrame behavior between 17 and 18.
Reporter | ||
Comment 7•12 years ago
|
||
Yes you were right, the small test i did shows similar numbers in Firefox 17. The interesting thing is that animations look pretty smooth in Firefox 17, but they are not smooth at all in Firefox 18. Based on the time of requestAnimationFrame every animation should be jerky.
However, as Boris said earlier it really is the same problem as bug 731974. Obviously it is still an issue. Thank you very much for your help.
![]() |
||
Comment 8•12 years ago
|
||
But 731974 is fixed in 20, not in 18... If you're willing to try a build from http://nightly.mozilla.org/ and see how things look there, that would tell us whether it fixed the problem you're seeing or not. I can totally understand if you don't want to spend the time doing that, of course!
Reporter | ||
Comment 9•12 years ago
|
||
Okay i understand, sorry for the misunderstanding. If someone has FF 20 already it is pretty obvious when you look at the numbers. Anyway, if i have some spare time next weekend i will give it a try.
Reporter | ||
Comment 10•12 years ago
|
||
I have downloaded the latest nightly build (21.0a1 2013-01-11) and requestAnimationFrame works better compared to Firefox 18. But it's far from perfect, please look at the numbers below. I show the delta-times from one frame to the next in milliseconds:
Firefox 21.0a1 2013-01-11:
14,13,17,17,21,14,16,16,18,18,16,20,15,14,16, ...
Firefox 18:
14,15,30, 0,14,14,14,21,16, 7,15,16,19,17,13, ...
Chrome 24.0.1312.52
16,17,17,16,16,17,16,17,16,17,17,17,16,17,17, ...
IE 10 (already supports the new sub-millisecond resolution)
16.669, 16.718, 16.638, 16.514, 16.666, 16.686, 16.683, ...
I hate it to say, but IE10 works best.
![]() |
||
Comment 11•12 years ago
|
||
OK. The main question I have is whether the actual visible behavior (the thing you say got worse from 17 to 18) is any better in the nightly.
Vlad, see comment 10?
![]() |
||
Comment 12•12 years ago
|
||
One other question. If, instead of logging the argument to the function, you log the values of performance.now() (in Chrome you'll need to use performace.webkitNow()), what do you see? That will differentiate between noise in firing the callback and noise in the passed-in argument (which somewhat unrelated to when the callback fires).
Reporter | ||
Comment 13•12 years ago
|
||
Same test with performance.now();
Firefox 21.0a1 2013-01-11:
4.25, 17.99, 16.00, 19.4, 14.2, 16.49, 18.02, 21.19, 13.77, ...
Firefox 18:
23.58, 7.09, 13.32, 15.00, 15.67, 16.3, 17.1, 17.56, 22.03, ...
Chrome 24.0.1312.52:
16.99, 16.99, 15.99, 16.99, 16.99, 16.00, 17.00, 16.99, ...
IE 10:
16.95, 16.44, 16.63, 16.70, 16.75, 16.62, 16.67, 16.75, ...
Again Firefox shows the worst results.
Reporter | ||
Comment 14•12 years ago
|
||
Answer to comment 11: Yes the animation looks a little bit smoother in Firefox nightly compared to Firefox 18. But it is not as smooth at it is in Chrome or IE (as the numbers show too).
![]() |
||
Comment 15•12 years ago
|
||
Would you mind attaching the testcase you used to generate comment 13, just so we're looking at the same thing?
Reporter | ||
Comment 16•12 years ago
|
||
![]() |
||
Comment 17•12 years ago
|
||
Thanks. Ok, yeah, that's what I was looking for.
I see quite different behavior on Mac (in particular, Chrome is much bouncier there), so this sounds like more Windows-specific timer fun...
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 18•9 years ago
|
||
jQuery is seeing similar behaviour in their detailed analysis on switching to rFA for animations: https://github.com/jquery/jquery/issues/3143
:milan recommended to ni? :bz
Flags: needinfo?(bzbarsky)
Comment 19•9 years ago
|
||
The jQ team added more details in a bug they just filed: https://bugzilla.mozilla.org/show_bug.cgi?id=1278408
Comment 20•9 years ago
|
||
I made this CodePen to help visualize the timestamp jitter: https://codepen.io/joliss/pen/ZObOPm
In Chrome, the line is usually straight, whereas in Firefox we get jitter. See the screenshots :m_gol and I posted at https://bugzilla.mozilla.org/show_bug.cgi?id=1278408
![]() |
||
Comment 21•9 years ago
|
||
All the discussion in this bug predates firing rAF from vsync, so I'm not sure how relevant it is at this point. As far as bug 1278408 goes, see bug 1278408 comment 1278408.
Flags: needinfo?(bzbarsky)
Comment 22•9 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #21)
> All the discussion in this bug predates firing rAF from vsync, so I'm not
> sure how relevant it is at this point.
Then is this bug still valid at all?
![]() |
||
Comment 23•9 years ago
|
||
I don't know.
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•