Closed
Bug 1338910
Opened 8 years ago
Closed 8 years ago
Context with const are slow
Categories
(Core :: JavaScript Engine: JIT, defect, P1)
Tracking
()
RESOLVED
FIXED
People
(Reporter: memmie, Assigned: tcampbell)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
(deleted),
text/html
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0
Build ID: 20170209120619
Steps to reproduce:
I reduce the problem to the following test:
```
const test = "";
function noop(){test;}
console.time("5m empty loop const");
for (var i = 0; i < 5000000; i++);
console.timeEnd("5m empty loop const");
```
```
var test = "";
function noop(){test;}
console.time("5m empty loop var");
for (var i = 0; i < 5000000; i++);
console.timeEnd("5m empty loop var");
```
The noop function have a reference to a constante in the same context. An empty loop is executed 5 million times.
Actual results:
5m empty loop const : minuteur démarré
5m empty loop const : 37.09 ms
5m empty loop var : minuteur démarré
5m empty loop var : 2.52 ms
The test with the reference to a constant spend ~15 more time than the one with the variable reference
Expected results:
The time spend should be the same. Better, the reference inside the noop shouldn't have any impact to the declaring context execution
Reporter | ||
Updated•8 years ago
|
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Comment 1•8 years ago
|
||
where do you put the code?
can you provide standalone testcase?
I confirmed the issue only if the code is not at toplevel, like, inside block, or inside function.
in that case, it should be the same issue as bug 1284590, that depends on bug 1273858.
Reporter | ||
Comment 2•8 years ago
|
||
Comment 3•8 years ago
|
||
thanks :)
confirmed.
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → JavaScript Engine: JIT
Depends on: 1273858
Ever confirmed: true
Comment 4•8 years ago
|
||
Bug 1273858 should fix this. Marking as P1 to retest when that lands.
Priority: -- → P1
Assignee | ||
Comment 5•8 years ago
|
||
(In reply to Hannes Verschore [:h4writer] from comment #4)
> Bug 1273858 should fix this. Marking as P1 to retest when that lands.
Confirmed. Bug 1273858 patches fix this on my build. As h4writer says, once that lands this can be retested.
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → tcampbell
Assignee | ||
Updated•8 years ago
|
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Comment 6•6 years ago
|
||
This seems to have broken again
const is 4x slower than var vs v8 where const is a few percent faster
https://jsperf.com/const-vs-var
You need to log in
before you can comment on or make changes to this bug.
Description
•