Is it worthy to move to pnpm and reduce carbon emissions ?
WIP PR in #2765
Criteria
- Time on CI and ability to start in warm cache
- Vercel deployment time and size
- Easy to maintain versions of the pm in ci, docker... (corepack will help in the future but not yet)
- Easy ways to build a docker image
- Best integration with tools like nx, turbo
Checklist
Tested on this monorepo with nextjs 12.3.1. At first sight pnpm is faster, but going into details... not sure.
| Check |
Yarn 4rc |
Pnpm 7 |
Winner |
| Laptop (cold cache) |
71.410 ± 1.835 |
34.696 ± 1.413 |
pnpm (x2) |
| Laptop (warm cache) |
21.576 ± 0.390 |
10.780 ± 0.881 |
pnpm (x2) |
| Github action (cold) |
±2m |
±1m20 |
pnpm (x1.8) |
| Github action (warm) |
±1m20 |
±50s |
pnpm (x1.3) |
| Vercel (warm) |
±2m20 |
±3m30s |
yarn |
| Vercel (ssr lambda size) |
25MB (8.88Mb) |
50MB (25Mb zip) |
yarn |
| Vercel (api routes) |
68Mb (22Mb zip) |
49.4 MB (22.6Mb zip) |
pnpm |
- Yarn is slower in ci & local but with the automatic rotation of its cache, it's run always (mostly) warm everywhere. So the difference is not huge. The warm cache works also in vercel.
- Yarn is commited in the github repo. No need to take care of different versions on CI, Github, local machines... Install is reproducible
- Vercel deployments/previews are slower (couldn't make pnpm cache as good as yarn).
- Lambdas size differs a lot... need more investigations (vercel/nft...)
PS: locally bench were done with hyperfine, timings on github are based on few runs and include the install and the action/cache (de-)compression. As yarn already compress the archives, the post compression is very fast (zstd is disabled for files that does not compress)
Links
Is it worthy to move to pnpm and reduce carbon emissions ?
WIP PR in #2765
Criteria
Checklist
Tested on this monorepo with nextjs 12.3.1. At first sight pnpm is faster, but going into details... not sure.
PS: locally bench were done with hyperfine, timings on github are based on few runs and include the install and the action/cache (de-)compression. As yarn already compress the archives, the post compression is very fast (zstd is disabled for files that does not compress)
Links