NPM@5 arrived. But is it as fast as Yarn?

May 31, 2017 in technology

Earlier this month I posted about how yarn is much faster than npm, but today NPM itself posted on Medium about npm@5 and how fast it has become. I fell like I need to add it to my former comparison, so here it goes.

New Lockfile

Shrinkwrap is (finally) deprecated. Now NPM creates/uses a package-lock.json (much better name :D) that is always created/updated much like the way Yarn does.

That means that all installations, for all devs on a team, will look the same.

Speed improvements

Says all package metadata and cache were been reworked to make npm from 20% to 100% faster. Cache is also self-healing too, to prevent corruption.

So let’s update our later comparison with npm@5 against Yarn.

  npm install yarn install
clean install (no cache)10.80s6.93s
cached7.82s4.89s
cached and lockfile present5.43s2.10s
cached and node_modules present2.22s4.18s
cached, lockfile and node_modules present2.07s0.67s

Yarn is still faster. But NPM@5 is installing dependencies on half the time or even less its prior version.

I’m not sure if it’s stable enough yet – considering the problems I had with npm shrinkwrap before – to justify a fallback to NPM. But it will certainly improve even more over time and maybe make Yarn obsolete.

I hope so.