-
-
Notifications
You must be signed in to change notification settings - Fork 34
perf: fast path for node_modules/package #839
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
perf: fast path for node_modules/package #839
Conversation
How to use the Graphite Merge QueueAdd the label merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
CodSpeed Performance ReportMerging #839 will improve performances by 6.51%Comparing Summary
Benchmarks breakdown
Footnotes
|
2d1ef5d to
3afbefa
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #839 +/- ##
==========================================
+ Coverage 93.88% 93.90% +0.02%
==========================================
Files 17 17
Lines 3091 3086 -5
==========================================
- Hits 2902 2898 -4
+ Misses 189 188 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3afbefa to
59ab98c
Compare
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 agree that this won't be a problem in practice. I think it'd be nice to mention this somewhere in the README as it differs from how Node resolves.
|
I guess the other thing that oxc-resolver doesn't support is the |
never heard of |
|
Many legacy things in CJS 😄. It is this: https://nodejs.org/api/modules.html#loading-from-the-global-folders |
Merge activity
|
In cjs, the spec states ``` LOAD_NODE_MODULES(X, START) 1. let DIRS = NODE_MODULES_PATHS(START) 2. for each DIR in DIRS: a. LOAD_PACKAGE_EXPORTS(X, DIR) b. LOAD_AS_FILE(DIR/X) c. LOAD_AS_DIRECTORY(DIR/X) ``` `2.b. LOAD_AS_FILE(DIR/X)` never occurs in modern package managers, and I do not recall any circumstance that creates a lone `node_modules/X.js` file. This reduces a package lookup from ``` node_modules/X.js node_modules/X.json node_modules/X.node node_modules/X/index.js ``` to ``` node_modules/X/ (if X failed) node_modules/X.js node_modules/X.json node_modules/X.node ``` NOTE: ESM does not have `LOAD_AS_FILE(DIR/X)` logic. --- This change was introduced from - `https://github.com/oxc-project/oxc-resolver/pull/592` - `https://github.com/unrs/unrs-resolver/pull/116` These PRs do not explain a real case for `node_modules/X.js` to accept such performance regression.
59ab98c to
f513bbd
Compare
In cjs, the spec states
2.b. LOAD_AS_FILE(DIR/X)never occurs in modern package managers, and I do not recall any circumstance that creates a lonenode_modules/X.jsfile.This reduces a package lookup from
to
NOTE: ESM does not have
LOAD_AS_FILE(DIR/X)logic.This change was introduced from
https://github.com/oxc-project/oxc-resolver/pull/592https://github.com/unrs/unrs-resolver/pull/116These PRs do not explain a real case for
node_modules/X.jsto accept such performance regression.