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
Improve resolver performance #6328
Conversation
|
@@ -798,18 +803,27 @@ export default class NodeResolver { | |||
return null; | |||
} | |||
|
|||
let pkgKeys = ['source', 'alias']; | |||
if (env.isBrowser()) pkgKeys.push('browser'); | |||
if (pkg.source && !Array.isArray(pkg.source)) { |
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.
Making this function use static references rather than dynamic property accesses seems to improve performance quite a bit
@@ -87,7 +88,7 @@ export async function loadConfig( | |||
if (parse === false) { | |||
config = configContent; | |||
} else { | |||
let parse = getParser(extname); | |||
let parse = opts?.parser ?? getParser(extname); |
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 isn't part of the configCache
cache key. But I also can't think of a case where you would want to parse a single file with 2 different parsers.
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.
Yeah, let's hope not 😉
Benchmark ResultsKitchen Sink ✅
Timings
Cold Bundles
Cached Bundles
React HackerNews ✅
Timings
Cold BundlesNo bundle changes detected. Cached Bundles
AtlasKit Editor ✅
Timings
Cold Bundles
Cached Bundles
Three.js ✅
Timings
Cold BundlesNo bundle changes detected. Cached Bundles
|
…raph * bdo/buffer-backed-graph: (37 commits) Improve resolver performance (#6328) v2.0.0-beta.3.1 Add it to the nightly release workflow as well Configure jemalloc page size for M1 (#6314) Update swc (#6307) Fix parcelDependencies v2.0.0-beta.3 Update swc (#6289) Remove old AdjacencyList, serialize EfficientGraph in Graph, update BundleGraph to use new functions Babel ast location, diagnostic, and source location remapping (#6238) update contributing guide (#6293) Update sourcemap to rc-1.0 (#6279) Serve nearest index.html in case the applications has multiple index files (#6250) Allow bundling browserify bundles by replacing free requires with undefined (#6260) Upgrade flow to 0.151.0 (#6281) Use local require for `@babel/core` and `postcss` (#6264) Resolve helpers relative to JS transformer (#6278) Pure comment for $parcel$interopDefault (#6271) Don't transpile spread in JSX with modern targets (#6274) Update TS validator assertions (#6272) ...
Utilizes the config loading mechanism used by other stuff for loading package.json files in the resolver, which has a per-build cache. Improves perf on the esbuild benchmark by ~8% for me.