Executing loop with 'instanceof' 9 times takes 100x longer than executing it 8 times
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
People
(Reporter: tszynalski, Unassigned)
Details
Attachments
(1 file)
585 bytes,
text/x-c
|
Details |
Comment 1•9 years ago
|
||
Comment 2•9 years ago
|
||
Comment 3•9 years ago
|
||
Comment 4•9 years ago
|
||
Comment 5•9 years ago
|
||
Reporter | ||
Comment 6•9 years ago
|
||
Updated•2 years ago
|
Comment 7•5 months ago
|
||
test1: https://share.firefox.dev/4ecAAJ1 (158ms with the profiler)
test2: https://share.firefox.dev/3XywdCu (206ms with the profiler)
There is a perf difference, but nothing like 100x. Should we close this bug?
Comment 8•3 months ago
|
||
For the reasons Jan laid out in comment 4 and comment 5, this isn't a particularly interesting bug.
The big performance cliff was simply because one version (i < 8) had monomorphic types after leaving the interpreter, whereas the i<9 version ran just long enough for the last iteration of the first loop to run in the baseline compiler, making the set of observed types in the baseline compiler polymorphic and pessimizing the code. Any system that doesn't observe types for the first few iterations (eg our interpreter) will inevitably have a similar performance cliff, although I think it should be smaller these days.
Description
•