Closed Bug 851120 Opened 11 years ago Closed 5 months ago

SpiderMonkey regressions in for-loop variants since Firefox 19

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: djvj, Unassigned)

References

Details

(Keywords: perf, regression, reproducible)

The following set of test cases was made by Olivier Yiptong for some JS code he was writing:

http://jsperf.com/scan-max-index/3

Running it on my Macbook, latest nightly vs. release build, I got the following numbers (higher is better):

NIGHTLY
-------
forEach - 34617
Math.max.apply - 56233
for..in - 14376
for..of - 11911
for loop - 346076

FIREFOX 19
----------
forEach - 10643
Math.max.apply - 131811
for..in - 15059
for..of - 14115
for loop - 329102


In the "Math.max.apply", "for..in" and "for..of" cases, nightly is regressing compared to trunk.

Is this a hoisted "forEach" issue?  I.e. the first case uses a forEach, but performs well because TI reports a single callback for it, so it's able to inline it and gain better performance.  The second case also uses a forEach, but by then there are multiple callbacks on record with TI, so it's not able to inline, and so it performs worse?

Regardless, the "Math.max.apply" case is taking a huge hit going from 19 to 22. This should be looked into.
That analysis is almost certainly correct, yes.

Bug 804676 should fix this, if I understand shu and bhackett correctly.
Depends on: 804676
This bug is still relevant. Nightly 32 is still slower than Firefox 19 on the Math.max.apply and for..in tests. Nightly 32 might also be slightly slower than Firefox 29 on the forEach and for..of tests. The good news is that we're faster than Chrome on all the tests. :)

FIREFOX 19
----------
forEach = 46,372
Math.max.apply = 176,998
for..in = 17,517
for..of = 15,691
for loop = 381,710

FIREFOX 29
----------
forEach = 56,018
Math.max.apply = 162,944
for..in = 14,303
for..of = 20,824
for loop = 1,091,329

NIGHTLY 32
----------
forEach = 55,601
Math.max.apply = 138,192
for..in = 12,932
for..of = 19,193
for loop = 1,248,784

CHROME 35
---------
forEach = 31,774
Math.max.apply = 24,806
for..in = 10,360
for..of = N/A
for loop = 460,230
Summary: SpiderMonkey regressions in for-loop variants between Ffx19 and Ffx22. → SpiderMonkey regressions in for-loop variants since Firefox 19
Assignee: general → nobody
NIGHTLY 41
----------
forEach = 34,386
Math.max.apply = 84,786
for..in = 7,160
for..of = 30,812
for loop = 184,207

CHROME 43
---------
forEach = 43,268
Math.max.apply = 13,051
for..in = 5,054
for..of = 18,050
for loop = 357,395


For some reason, 'for loop' is way slower than it used to be, at least on this testcase.
On the other hand, 'for of' got a lot faster.
Severity: normal → S3
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.