Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
doc, lib, test: do not re-require needlessly#14244
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
vsemozhetbyt commented Jul 15, 2017
lib/internal/process.js Outdated
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.
It seems that the intention in this file was to do this require only when really needed so I'm not sure if it's a good idea to require it unconditionally.
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've checked this. If I don't miss something, this module is required only in the bootstrap_node.js and the function which requires utilis called there unconditionally.
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.
Ok, thanks.
test/sequential/test-util-debug.js Outdated
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 honestly find the original easier in this case, no changes required imho.
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.
Reverted.
test/common/index.js Outdated
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.
could this be made like..
const{ execSync, spawn }=require('child_process');?
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.
Done for all four methods.
vsemozhetbyt commented Jul 17, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
vsemozhetbyt commented Jul 20, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Rebased. CI: https://ci.nodejs.org/job/node-test-pull-request/9265/ (green). |
vsemozhetbyt commented Jul 21, 2017
Landed in 4f87522 |
PR-URL: #14244 Reviewed-By: Alexey Orlenko <[email protected]>
addaleax commented Jul 27, 2017
This doesn’t land cleanly on 8.x; if you can, please follow the guide and raise a backport PR, if you don’t think it’s worth it let me know/add the |
vsemozhetbyt commented Jul 27, 2017
8.x backport: #14524 |
Backport-PR-URL: #14524 Backport-Reviewed-By: Anna Henningsen <[email protected]> PR-URL: #14244 Reviewed-By: Alexey Orlenko <[email protected]>
MylesBorins commented Aug 16, 2017
v6.x backport please 😄 |
vsemozhetbyt commented Aug 16, 2017
@MylesBorins |
PR-URL: #14244 Reviewed-By: Alexey Orlenko <[email protected]>
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
doc, lib, test
While cached, re-requiring still has some overhead. So I've checked various patterns prone to re-requiring and tried to reduce it.
Lazy loadings are not touched: if there is a chance that a module may not be required at all, potential re-requiring is left as is.
I have a doubt concerning
pummel\test-vm-memleak.js: if it tests leaking inrequireamong other leaks, let me know to revert; otherwise the pummelling can be reduced a bit this way.