Saltar al contenido principal

Benchmarks of JavaScript Package Managers

Last benchmarked at: Jan 17, 2022, 2:57 AM (daily updated).

This benchmark compares the performance of npm, pnpm, Yarn Classic, and Yarn PnP (check Yarn's benchmarks for any other Yarn modes that are not included here).

Here's a quick explanation of how these tests could apply to the real world:

  • clean install: How long it takes to run a totally fresh install: no lockfile present, no packages in the cache, no node_modules folder.
  • with cache, with lockfile, with node_modules: After the first install is done, the install command is run again.
  • with cache, with lockfile: When a repo is fetched by a developer and installation is first run.
  • with cache: Same as the one above, but the package manager doesn't have a lockfile to work from.
  • with lockfile: When an installation runs on a CI server.
  • with cache, with node_modules: The lockfile is deleted and the install command is run again.
  • with node_modules, with lockfile: The package cache is deleted and the install command is run again.
  • with node_modules: The package cache and the lockfile is deleted and the install command is run again.
  • update: Updating your dependencies by changing the version in the package.json and running the install command again.

Lots of Files

The app's package.json here

actioncachelockfilenode_modulesnpmpnpmYarnYarn PnP
install1m 7.1s14s16.6s23.6s
install1.7s1.2s2.3sn/a
install10s3.5s6.8s1.5s
install14.3s6.9s11.2s6.2s
install25.7s11.6s12s17.9s
install2.2s1.7s7sn/a
install1.7s1.2s7.6sn/a
install2.2s4.9s11.8sn/a
updaten/an/an/a1.6s10s15.5s28.3s

Graph of the alotta-files results

The reason pnpm is fast

Why is pnpm so crazy fast compared to other "traditional" package managers?

pnpm doesn't have blocking stages of installation. Each dependency has its own stages and the next stage starts as soon as possible.