-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
lib: var to const #13756
lib: var to const #13756
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion on this if someone can confirm that there is no performance degression.
@tniessen I just compared the streams and the performance did not change:
|
Ref: #13729 |
So it's probably worth thinking about backporting here. If this cannot be backported to v6.x due to deoptimisations then that will make it very difficult to backport any other changes after this. Maybe the answer is to wait until v6.x goes into maintenance. I'm +1 on removing Thoughts @nodejs/lts ? |
@gibfahn I am running the deopt test in v6 with and without all |
Just as info - I am going to update this as soon as v8 6.1 lands. The deopt test does not work anymore with Turbofan as there are pretty much no deopts but bmeurer (not mentioning him here because he does not need to be summoned for it) fixed a deopt in #13403 (comment) and as he said that will be fixed with 6.1. So I think we are pretty safe going forward from that point on. |
5b8aa51
to
a85436c
Compare
Rebased. As v8 6.1 has landed this can now also properly land. |
Another ping @nodejs/lts re backporting concerns for this. I'm still thinking it might be better to wait for It's annoying that there isn't an eslint rule we can add for this, I guess we could enable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM but I'd like to see some benchmarks and a CITGM run.
@jasnell any const that might be reassigned would trigger (or at least should) an eslint error. Those var statements were in fact changed by eslint and not by me (that would be a horrible amount of work...) so two rules would have to make a mistake here. a) the prefer-const rule and b) no-const-assign rule. I am also not sure how CITGM could show any issues because all those variables can not be reassigned by a user. Another main aspect is that the tests would very likely fail if there is a reassignment for any const because we have a quite decent coverage for such changes. I would like to get this landed soon because the code base changes fast and I would have to rebase often otherwise. |
Indeed, no arguments there. CITGM is not a blocker, it's just advisory just in case. |
I just thought about @gibfahn s comment again about backporting... It is indeed going to make our lives miserable to backport things to v6.x. We should not backport this PR to v6.x because there are some deoptimizations possible in some cases and therefore it would increase the amount of conflicts for many backports. So... I believe you would be much happier with that? @gibfahn |
Happier is the wrong word, I'd personally rather we could use I'll put this on the LTS (now Release) agenda, and we'll discuss at the next meeting. |
Agreed to wait 6 months to do this sweep. At that point, 6.x will be in maintenance, and this can be applied to master and backported to 8.x safely at that time. |
Thx closing this in that case. |
As discussed in #13732: this will change all
var
toconst
if applicable.The main question is if this is wanted due to the churn.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
lib