How did Firefox optimize this loop?

Looking at the results its pretty clear that Firefox didn’t do anything to achieve a performance gain.

browserscope

These bars can be read as “speeds” (operations/sec) so bigger bars are better. Everything is to scale.

In Firefox 9, its very clear the “Math” method performs abysmally, while there is little change in “Loop” method between versions.

So there was no “optimization” of any sort in Firefox 9. All that happened between Firefox 8 and 9 with regard to these tests is somehow their math library got slower (Math.pow being slow), or their string library got slower (.slice() being slow).

Looking into this further, it’s clear somehow these elementary operations got a bit slower in ff9:

ff8 vs ff9

Both concatenation and Math.pow are a bit slower in FF 9 than in FF 8, which may account for the difference you see in your tests.

Interestingly, the new no-op bar is much longer in FF8 than FF9.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)