JavaScript var vs let (de)optimization/slowdown issue in FF/SpiderMonkey
Categories
(Core :: JavaScript Engine: JIT, defect, P3)
Tracking
()
People
(Reporter: olvap80, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: triage-deferred)
Attachments
(1 file)
69.98 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0 Build ID: 20170504105526 Steps to reproduce: I've switched to modern JavaScript in my projects and noticed that new "let" statement sometimes slows down my application loops drastically: For minimal working example please see https://jsfiddle.net/5yxytm9z/ and compare loop times. Actual results: On FF 53.0.2 (32-bit) https://jsfiddle.net/5yxytm9z/ produces: without_let: 93.81ms let_below: 98.19ms let_above_and_in_loop: 894.19ms <---- Slowdown! let_in_loop: 99.63ms all_let: 878.05ms <---- Slowdown! Expected results: All the loops shall perform similarly, without slowdowns.
Updated•7 years ago
|
Comment 1•7 years ago
|
||
let should already be faster in Firefox 54 (currently Beta, I think), because of bug 1273858. But there is definitely still remove for improvements.
Comment 2•7 years ago
|
||
s/remove/room/ ..
Comment 3•7 years ago
|
||
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0 without_let: 137.3ms let_below: 137.48ms let_above_and_in_loop: 137.38ms let_in_loop: 136.4ms all_let: 136.23ms This bug can be closed, right?
Updated•7 years ago
|
Comment 4•5 years ago
|
||
In Firefox 66 ========================= without_let: 95ms let_below: 94ms let_above_and_in_loop: 297ms let_in_loop: 94ms all_let: 298ms ========================= without_let: 95ms let_below: 94ms let_above_and_in_loop: 296ms let_in_loop: 94ms all_let: 299ms so there is still some issue here.
Comment 5•5 years ago
|
||
I looked into this again. We should certainly allocate the lexical environment object in JIT code. For this micro benchmark at least we probably can't do any scalar replacement, because we have the OSR entry.
Comment 6•4 years ago
|
||
Linux amd64
Firefox 68.5.0esr
without_let: 100ms
let_below: 98ms
let_above_and_in_loop: 303ms
let_in_loop: 96ms
all_let: 304ms
Firefox Nightly 75.0a1 (2020-03-06)
without_let: 101ms
let_below: 96ms
let_above_and_in_loop: 96ms
let_in_loop: 98ms
all_let: 101ms
So it looks to be fixed in Nightly now.
Updated•3 years ago
|
Comment 7•3 years ago
|
||
Hi.. I've just tested this in 85.0.2 (64-bit), and unfortunately it's still (or again?) an issue:
without_let: 105ms
let_below: 101ms
let_above_and_in_loop: 262ms
let_in_loop: 101ms
all_let: 260ms
Comment 8•3 years ago
|
||
(In reply to matthew.w.fearnley from comment #7)
Hi.. I've just tested this in 85.0.2 (64-bit), and unfortunately it's still (or again?) an issue:
Thanks for the heads-up! It regressed with the new compiler. I've filed bug 1692855 and bug 1692856 to investigate this further.
Description
•