-
Notifications
You must be signed in to change notification settings - Fork 124
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
Add emitDependency caching and fix pnpm symlinks #238
Conversation
Codecov Report
@@ Coverage Diff @@
## main #238 +/- ##
==========================================
+ Coverage 81.25% 81.28% +0.03%
==========================================
Files 13 13
Lines 1472 1480 +8
Branches 545 546 +1
==========================================
+ Hits 1196 1203 +7
- Misses 109 110 +1
Partials 167 167
Continue to review full report at Codecov.
|
const emitDependencyPromise = new Promise<FilesToEmit>(async (resolve, reject) => { | ||
try { | ||
const curFilesToEmit: FilesToEmit = { files: [], reasons: {} } | ||
const job = new Proxy(this, { |
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.
Why use a proxy here?
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's to allow us to catch all calls to emitFile
even nested ones and add the files to the cache.
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.
Nice work! 🎉
Great improvements, and looks good to me, didn't read all the code but could just ask a few questions if it would help:
|
It seems eliminating iterating over the dependencies reduces the time significantly on large projects e.g. thousands of dependencies with > 100 separate runs of I think currently we should consider the |
This really is very surprising to me, as it is fully possible to iterate 1000s of modules in well under a second. So there must be something else going on. Could be worth digging into some further analysis there, but this PR is good to land too of course. |
Perhaps there is some quadratic behaviour in the iteration? |
This updates to the latest version of `@vercel/nft` which includes better shared caching between runs. x-ref: vercel/nft#239 x-ref: vercel/nft#238 x-ref: vercel/nft#237
@@ -0,0 +1,11 @@ | |||
[ | |||
"test/unit/pnpm-symlinks/input.js", | |||
"test/unit/pnpm-symlinks/node_modules/.pnpm/parse5-htmlparser2-tree-adapter@6.0.1/node_modules/parse5", |
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.
Is this an expected behavior that includes symlink directories in fileList
?
This updates to the latest version of `@vercel/nft` which includes better shared caching between runs. x-ref: vercel/nft#239 x-ref: vercel/nft#238 x-ref: vercel/nft#237
This removes the
resolve
caching introduced in #237 and replaces it with caching the entireemitDependency
call so that all nested operations shouldn't need to be cache separately.This provides much better performance than the previous caching as testing against a couple large apps showed these results: