After my earlier post on analyzing JavaScript timer performance a lot has changed, especially in Firefox 3. An excellent patch landed the other day which is giving us some excellent performance improvements – not the least of which is related to timers.
If you remember from before I took a look at how responsive JavaScript timers were on OSX in Firefox 2, Safari 3, Firefox 3, and Opera 9. The conclusion, at least for me, was that Firefox 3’s timers were much improved over Firefox 2’s, but could stand some improvement.
I filed a couple bugs, relating to the matter:
And to my delight this new patch completely resolves all of them. Let’s take a quick peak at the results. These are the results of doing setInterval(fn, 0);
in Firefox 2, Safari 3, Firefox 3, and Opera 9. Firefox 3 is in the bottom-left corner, note the improvement.
The change in quality is startling. It’s easy to say that Firefox 3 and Safari 3 are quite comparable now, in terms of overall timer quality and, if nothing else, a major improvement over the timers in Firefox 2.
If you want to try this improvement for yourself feel free to download a nightly of Firefox 3 and head on over to the timer test page, I think you’ll be quite pleased.
Jörn Zaefferer (February 21, 2008 at 3:45 am)
Great to see Firefox improving timer performance, looking forward to smooooooth animations.
What Opera version did you test? Supposedly Opera 9.5 brings quite a few performance improvements and should be, in terms of release dates, most likely the one to compare to Safari 3 and Firefox 3.
Fabian Jakobs (February 21, 2008 at 5:28 am)
This is good news. I guess this will improve the overall smoothness of animations in Firefox 3. Its great to see progress even in these corner cases. Now if only JavaScript performance would come closer to WebKit.
Alex (February 21, 2008 at 5:51 am)
Those after graphs show Firefox to be worse not better. The peaks before were generally under 20 and now they are often over 20. Excluding the last 2 result sets (64 and 128 timers) distorts the graphs a lot. I’d call higher timer variation a reduction in quality, and by excluding the higher values we have no idea how the scalability of timers has changed in Firefox.
Arthur (February 21, 2008 at 5:54 am)
@Alex: The interesting graph is the Minefield one (FF 3), not the one of Firefox 2.x.
Kevin H (February 21, 2008 at 11:11 am)
I’m seeing different results, John. Is it a Mac/Windows thing?
Kevin H (February 21, 2008 at 11:29 am)
The setTimout results are more promising, though.
Alex (February 21, 2008 at 12:16 pm)
Ah my bad, sorry about that. It would still be good if the graphs actually contained the same number of entries though.
John Resig (February 21, 2008 at 1:08 pm)
@Kevin H: Yes, this change is specific to OSX.
Mark Holton (February 22, 2008 at 1:37 pm)
…it would be interesting to see how the timers in Google Gears 0.2 fit into these data…