Closed Bug 1362930 Opened 8 years ago Closed 4 years ago

JavaScript var vs let (de)optimization/slowdown issue in FF/SpiderMonkey

Categories

(Core :: JavaScript Engine: JIT, defect, P3)

53 Branch
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: olvap80, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: triage-deferred)

Attachments

(1 file)

Attached image FF_let_Slowdown.png (deleted) —
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.
Component: Untriaged → JavaScript Engine: JIT
Product: Firefox → Core
let should already be faster in Firefox 54 (currently Beta, I think), because of bug 1273858. But there is definitely still remove for improvements.
Depends on: 1341937
s/remove/room/ ..
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?
Keywords: triage-deferred
Priority: -- → P3
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.
Blocks: es6perf

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.

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.

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED

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

(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.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: