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

UNCONFIRMED
Unassigned

Status

()

Core
JavaScript Engine: JIT
P3
normal
UNCONFIRMED
5 months ago
26 days ago

People

(Reporter: olvap80, Unassigned)

Tracking

(Depends on: 1 bug, {triage-deferred})

53 Branch
triage-deferred
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 months ago
Created attachment 8865333 [details]
FF_let_Slowdown.png

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

5 months ago
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/ ..

Comment 3

4 months 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?
Keywords: triage-deferred
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.