-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
let slows down performance by 5 times #5815
Comments
This is a known issue, v8 just hasn't optimized some of the ES6 features yet. There's nothing node can really do about that. |
V8 hasn't even optimized most of the ES5 features yet. |
|
I'm going to close this as this is an issue that would need to be resolved on the v8 side of things. Feel free to re-open or comment if anyone feels like closing is a mistake. Also, despite being closed, feel free to comment if there are additional questions or observations. |
FWIW there is a PR (#5819) that fixes this. |
@mscdex Correct me if I'm mistaken, but I think that just fixes a few instances of |
I run some tests and indeed replacing let with var in for loops significantly mitigates the issue. However a version of my test with let is still about 20% slower, than the one with var's. I think the loop somehow multiplies this delay when let it used to define the index. |
@AlekseyMalyshev Here's the relevant issue in the v8 tracker: https://bugs.chromium.org/p/v8/issues/detail?id=4762 |
I wrote this simple performance test recently.
There are two versions of JavaScript:
euler35/euler35.js
euler35/euler35-es6.js
The only difference is that es6 contains "use strict"; on top and uses let instead of var. This simple change however decreased ES6 performance by more than 5 times! I do not believe this should be the case. Full details are here.
The text was updated successfully, but these errors were encountered: