-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
perf(pnp): use default Module._load
#5483
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
Conversation
- packages/yarnpkg-pnp/sources/hook.js | ||
- packages/yarnpkg-pnp/sources/esm-loader/built-loader.js |
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.
That will cause the E2E tests to run inside many PRs; the idea was to only run them inside the master branch, to avoid using too many GH Action resources. At the very least, should be moved to a separate PR to make a rollback easier.
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'll revert it but that was the point, to catch potential issues with changes to the PnP hook earlier.
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.
✅ minus the E2E part
This reverts commit ebce2be.
**What's the problem this PR addresses?** We're unnecessarily patching `Module._load` more than we need to which skips important optimisations in Node.js. Fixes #4301 **How did you fix it?** Use the default `Module._load` when the request isn't `pnpapi`. **Results** ```console $ hyperfine -w 1 "cd berry-before && yarn test:lint" "cd berry && yarn test:lint" Benchmark 1: cd berry-before && yarn test:lint Time (mean ± σ): 18.475 s ± 0.400 s [User: 25.934 s, System: 1.695 s] Range (min … max): 18.010 s … 19.249 s 10 runs Benchmark 2: cd berry && yarn test:lint Time (mean ± σ): 14.187 s ± 0.144 s [User: 21.348 s, System: 1.504 s] Range (min … max): 13.929 s … 14.409 s 10 runs Summary 'cd berry && yarn test:lint' ran 1.30 ± 0.03 times faster than 'cd berry-before && yarn test:lint' $ hyperfine -w 1 "cd berry-before && yarn --version" "cd berry && yarn --version" Benchmark 1: cd berry-before && yarn --version Time (mean ± σ): 2.011 s ± 0.010 s [User: 1.833 s, System: 0.582 s] Range (min … max): 2.001 s … 2.029 s 10 runs Benchmark 2: cd berry && yarn --version Time (mean ± σ): 1.866 s ± 0.009 s [User: 1.726 s, System: 0.538 s] Range (min … max): 1.856 s … 1.886 s 10 runs Summary 'cd berry && yarn --version' ran 1.08 ± 0.01 times faster than 'cd berry-before && yarn --version' ``` **Checklist** - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). - [x] I have set the packages that need to be released for my changes to be effective. - [x] I will check that all automated PR checks pass before the PR gets reviewed. --------- Co-authored-by: Maël Nison <[email protected]>
What's the problem this PR addresses?
We're unnecessarily patching
Module._load
more than we need to which skips important optimisations in Node.js.Fixes #4301
How did you fix it?
Use the default
Module._load
when the request isn'tpnpapi
.Results
Checklist