Closed
Bug 1769677
Opened 3 years ago
Closed 3 years ago
Using a WITH statement on Firefox takes more time than on Chrome
Categories
(Core :: JavaScript Engine, enhancement)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: xuelanxu, Unassigned)
References
(Blocks 1 open bug)
Details
Steps to reproduce:
function main() {
const v48 = [1000.0];
with (v48) {
}
for (let v87 = 0; v87 < 1000; v87++) {
for (let v93 = 0; v93 < 1000; v93++) {
}
}
}
let t = performance.now();
main();
console.log(performance.now() - t)
Actual results:
Firefox(100.0.1): 44 milliseconds
Chrome(101.0.4951.67): 1.1 milliseconds
Expected results:
Times in the same ballpark.
Comment 1•3 years ago
|
||
Using with
is not recommended, see the warning on MDN. Also, with
statements are not allowed in strict-mode ("use strict"
). SM doesn't really try hard to optimize functions containing with
because of this.
Comment 2•3 years ago
|
||
To be clearer, SpiderMonkey currently uses with
all over its test suite to explicitly prevent code from being optimized.
Comment 3•3 years ago
|
||
Unless there is a compelling use case which is getting spread across the web, I will flag this issue as WONTFIX.
Comment 4•3 years ago
|
||
Looking at a JS code sample from the top 50 websites taken in 2019, the with
keyword appears 160 times over 379016763 characters.
You need to log in
before you can comment on or make changes to this bug.
Description
•