-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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(zip)!: don't access the filesystem from wasm #5178
Conversation
That seems reasonable. It's also what #5145 does. |
@paul-soporan I sometimes bench pnpm and yarn... Lately I saw a perf boost somewhere from yarn 4.0.0-rc.35 and 36 with a monorepo (nextjs, vite, esbuild, vitest...) Not sure if it's linked but wanted to let you know. The benchs:
Note that it's the first time the install was globally equal than pnpm (YARN_COMPRESSION_LEVEL=0, node_modules, supportedArch current and dedupe)... pnpm does download more (peer-deps are handled differently and no support for supportedArch afaik - so the comparison in not totally right) Speedup appreciated ♻️🌳 |
Is this change available in yarn 3.x? |
No, this PR is a breaking change so it can't be backported. |
@merceyz I only read the summary here, didn't dig into the details, but can you help me understand why we can't backport this? We really need this in our monorepo :) IDK if there is a timeline for yarn 4 or not... |
Depends on #5179.
What's the problem this PR addresses?
This PR makes
ZipFS
read the archive directly inside the constructor from Node and passing a buffer to libzip instead of making libzip read it with a shimmed FS.Consequently,
ZipFS
now only accesses the filesystem twice for each archive (first time in the constructor and second time insaveAndClose
) and therefore doesn't have to keep an fd handle to the archive while it is open.This means that now:
This could have the consequence of allowing us to increase the fetcher and linker concurrency limits, but I haven't tested it yet.
Fixes #5172.
Fixes #4488.
How did you fix it?
This has the advantage of greatly reducing the bundle size since libzip doesn't have to bundle the FS shims anymore:
It also seems to bring performance improvements on
yarn install
(though earlier I saw some mixed results when benchmarking the time of accessing many archives so if anybody wants to run more benchmarks feel free, but I'd say that it's good enough since I could consistently reproduce the Yarn speedup):Checklist