Skip to content

Conversation

@vsemozhetbyt
Copy link
Contributor

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected 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 in require among other leaks, let me know to revert; otherwise the pummelling can be reduced a bit this way.

@nodejs-github-botnodejs-github-bot added process Issues and PRs related to the process subsystem. repl Issues and PRs related to the REPL subsystem. tls Issues and PRs related to the tls subsystem. labels Jul 15, 2017
@vsemozhetbytvsemozhetbyt added doc Issues and PRs related to the documentations. test Issues and PRs related to the tests. labels Jul 15, 2017
@vsemozhetbyt
Copy link
ContributorAuthor

Copy link
Member

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.

Copy link
ContributorAuthor

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks.

Copy link
Member

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.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted.

Copy link
Member

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');

?

Copy link
ContributorAuthor

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
Copy link
ContributorAuthor

vsemozhetbyt commented Jul 17, 2017

@vsemozhetbyt
Copy link
ContributorAuthor

vsemozhetbyt commented Jul 20, 2017

@vsemozhetbyt
Copy link
ContributorAuthor

Landed in 4f87522

@vsemozhetbytvsemozhetbyt deleted the no-re-require branch July 21, 2017 17:43
vsemozhetbyt added a commit that referenced this pull request Jul 21, 2017
@addaleax
Copy link
Member

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 dont-land-on label.

@vsemozhetbyt
Copy link
ContributorAuthor

8.x backport: #14524

addaleax pushed a commit that referenced this pull request Jul 28, 2017
Backport-PR-URL: #14524 Backport-Reviewed-By: Anna Henningsen <[email protected]> PR-URL: #14244 Reviewed-By: Alexey Orlenko <[email protected]>
@addaleaxaddaleax mentioned this pull request Aug 2, 2017
@MylesBorins
Copy link
Contributor

v6.x backport please 😄

@vsemozhetbyt
Copy link
ContributorAuthor

@MylesBorins
Backport PR: #14876

MylesBorins pushed a commit that referenced this pull request Sep 19, 2017
@MylesBorinsMylesBorins mentioned this pull request Sep 20, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docIssues and PRs related to the documentations.processIssues and PRs related to the process subsystem.replIssues and PRs related to the REPL subsystem.testIssues and PRs related to the tests.tlsIssues and PRs related to the tls subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@vsemozhetbyt@addaleax@MylesBorins@jasnell@lpinca@aqrln@nodejs-github-bot