Skip to content
Nilay Kabariya

Entry No.010·Tested·Updated ·6 min read

npm vs pnpm vs Yarn vs Bun: install speed benchmark (2026)

Four package managers, one real 370 MB project, three rounds on an ordinary laptop. Cold, cached and no-change installs timed, plus a disk-space surprise.

What changed on Nov 8, 2026: Re-ran the CI test with pnpm 12.18.0 and Bun 1.4.4: same ranking, Yarn 1 cache now over 3.2 GB.

by Nilay#npm#pnpm#bun#performanceTESTED

Verdict

pnpm is the best all-rounder: 2.8× faster than npm from a cold start and near-instant when nothing changed. Bun wins with a warm cache. Yarn 1 was the slowest and needed a 3.7 GB cache.

Tested on

npm
11.9.0
pnpm
12.5.1; 12.18.0 (CI, November 9)
Bun
1.4.2; 1.4.4 (CI, November 9)
Yarn
1.22.22 (classic)
Node
24.14.0
Machine
i3-1115G4, 2 cores, 12 GB, NVMe SSD
OS
Windows 11 Pro 26200
Network
~37 Mbps, ~95 ms to the npm registry

✓ Last re-run on GitHub Actions · see the run · all repros

The project is this blog’s own package.json: Astro, Tailwind, MDX, Cloudflare’s Wrangler and a few build tools. That comes to roughly 12,400 files and 370 MB in node_modules, a normal modern web app rather than a toy. Every tool installed exactly the same dependencies and ran the same install scripts.

The results

Cold install: new machine, empty cache, no lockfilelower is better · s
  1. pnpm35.6 sbest
  2. Bun39.6 s
  3. npm99.0 s
  4. Yarn 1190.1 s
Warm install: fresh clone, cache and lockfile presentlower is better · s
  1. Bun12.8 sbest
  2. pnpm16.5 s
  3. Yarn 116.7 s
  4. npm18.6 s
Nothing changed: run install again on a finished projectlower is better · s
  1. pnpm0.13 sbest
  2. Bun0.19 s
  3. Yarn 10.65 s
  4. npm1.69 s
Cache on disk after one installlower is better · MB
  1. pnpm393 MBbest
  2. Bun416 MB
  3. npm464 MB
  4. Yarn 13700 MB

Every run

Tool Cold (s) Warm (s) No change (s)
npm 103.85 · 94.34 · 98.99 18.58 · 19.24 · 17.09 1.73 · 1.69 · 1.37
pnpm 35.56 · 38.22 · 33.73 16.52 · 15.00 · 18.79 0.13 · 0.12 · 0.18
Bun 42.75 · 39.58 · 38.11 12.76 · 12.89 · 12.01 0.22 · 0.19 · 0.16
Yarn 1 190.11 16.70 0.65

Every run finished without errors or retries, and every tool produced a working node_modules and a lockfile.

Which one should you use?

  • Starting fresh, or CI without a cache: pnpm or Bun. Both did the cold install in under 40 seconds, where npm took about 99. On this project and connection, that’s roughly 2.8× (pnpm) and 2.5× (Bun) faster than npm.
  • Everyday work with a warm cache: Bun was quickest at 12.8 seconds. pnpm and npm were closer together than the cold numbers suggest (16.5 s vs 18.6 s).
  • Running install on a finished project: pnpm returned in 0.13 s, about 13× faster than npm’s 1.7 s. That’s the one you feel dozens of times a day in scripts and hooks.
  • npm still works fine. It was never broken, only slower, and it’s already installed with Node.
  • Yarn 1 (classic) was the slowest from cold and built a cache almost 10× larger than the others. If you use Yarn, look at modern Yarn (v4) instead. It wasn’t part of this test.

Two things that surprised me

The same test on fast CI machines

My laptop has a slow connection (~37 Mbps), so on November 3 I ran the same package.json, the same tool versions and the same three scenarios on GitHub Actions: three rounds on Linux, one on Windows, each tool with its own empty cache and the order rotating. Medians in seconds (cold / warm / no change):

Tool Linux (4 CPUs) Windows Server 2025 (4 CPUs) Cache after one install
npm 11.19.1 23.43 / 5.60 / 0.67 30.01 / 9.57 / 0.90 430–444 MB
pnpm 12.5.1 2.53 / 0.28 / 0.04 5.93 / 1.68 / 0.21 393–437 MB
Bun 1.4.2 1.72 / 0.32 / 0.04 10.88 / 7.85 / 0.11 407–538 MB
Yarn 1.22.22 24.62 / 3.32 / 0.33 39.34 / 6.77 / 0.42 2,735–2,761 MB

With a fast network, pnpm’s lead over npm grew from 2.8× to about 5× (Windows) and 9× (Linux) cold. Bun was the fastest cold install on Linux and slower than pnpm on Windows. Yarn 1 was again the slowest from cold, and its cache was again over 2.7 GB. pnpm 12 also refused again without allowBuilds: ERR_PNPM_IGNORED_BUILDS, Ignored build scripts: esbuild@0.28.2, workerd@1.20261101.1. The script and the run are public.

Re-run on November 9 with newer pnpm and Bun

Six days later pnpm was at 12.18.0 and Bun at 1.4.4, so I ran the CI test again with those (run 42515098834). Linux shows the median of three rounds, Windows one round; cold / warm / no change, in seconds:

Tool Linux (4 CPUs) Windows Server 2025 (4 CPUs) Cache after one install
npm 11.19.1 19.65 / 4.55 / 0.41 29.92 / 12.24 / 1.35 441–456 MB
pnpm 12.18.0 3.56 / 0.50 / 0.04 6.19 / 2.39 / 0.29 414–459 MB
Bun 1.4.4 2.49 / 0.15 / 0.04 11.32 / 6.47 / 0.15 417–484 MB
Yarn 1.22.22 34.59 / 5.25 / 0.24 53.16 / 7.53 / 0.63 3,212–3,239 MB

The order didn’t change: Bun is still the fastest cold install on Linux and pnpm on Windows, and Yarn 1 is still the slowest with the biggest cache, now over 3.2 GB. pnpm 12.18.0 still stops with ERR_PNPM_IGNORED_BUILDS until esbuild’s and workerd’s scripts are allowed. Times on shared CI machines move by 10–30% between runs, so read the gaps between tools, not the exact seconds.

How the laptop numbers were measured

  • Same project, same scripts. Every tool got the same package.json. pnpm and Bun were given permission to run the same two install scripts (esbuild, workerd) that npm and Yarn run by default, so no tool skipped work.
  • Separate, empty caches. Each tool got its own fresh cache folder for every round, so nothing was shared between tools or with the machine’s normal caches.
  • Called directly. Tools ran from their own installed binaries, not through npx, so none paid extra startup time.
  • Rotating order. The order changed every round, so a slow patch of network didn’t always hit the same tool.
  • Three rounds, median reported. The table above shows every individual run.
  • Three scenarios: cold (empty cache, no lockfile), warm (cache and lockfile present, node_modules deleted), no change (run install again right away).

Limits of this test

  • Yarn 1 ran once, not three times. Its 3.7 GB cache left this machine within 0.4 GB of a full drive, so I stopped it after round 1 rather than risk the system. Treat its numbers as one data point.
  • Cold installs mostly measure download speed. They were run on an ordinary ~37 Mbps connection. On a faster connection all four get quicker, and the gaps may shrink.
  • Windows only, one machine. These results come from one 2-core laptop. Linux and macOS, especially in CI, can rank differently.
  • Disk size note: pnpm’s node_modules links to its global store instead of copying, so on disk it uses less than the 373 MB counted here.

— N.K., end of entry No.010

Useful? Pass it on:Post on XFollow @EmotionalMatter

Related entries

  1. No.112

    pnpm 12 breaking changes, tested: the errors pnpm 11 didn't give

    Four commands that exited 0 on pnpm 11.28.13 failed on 12.21.0: a misspelled setting in a pinned project (ERR_PNPM_UNRECOGNIZED_WORKSPACE_SETTINGS), --frozen-lockfile false, --resolution-only, and sudo pnpm add -g (ERR_PNPM_SUDO_NOT_SUPPORTED). pnpm add yarn now changes packageManager instead of adding a dependency. Each of the four errors has a one-line fix; for the yarn change, pnpm documents a one-line specifier (`pnpm add yarn@npm:yarn@1.22.22`) that was not run.

    TESTED4 min
  2. No.011

    Bun vs Node.js 24 benchmark: startup, TypeScript and tests

    Bun started 1.7× faster, ran a TypeScript file 3× faster and finished the same test suite 5× faster. The tight number-crunching loop was close: Node won it on Bun 1.4.2, and on 1.4.3 it was a toss-up. The HTTP test hit a limit of this machine, not of either runtime.

    TESTED5 min
  3. No.105

    ERR_PNPM_IGNORED_BUILDS: onlyBuiltDependencies no longer works

    pnpm 11 and 12 fail installs with ERR_PNPM_IGNORED_BUILDS and ignore onlyBuiltDependencies. pnpm 10, 11 and 12 tested: the allowBuilds setting that passes.

    > Error: ERR_PNPM_IGNORED_BUILDS

    FIXED4 min

tip: paste the exact error text