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.80s | 6.93s |
cached | 7.82s | 4.89s |
cached and lockfile present | 5.43s | 2.10s |
cached and node_modules present | 2.22s | 4.18s |
cached, lockfile and node_modules present | 2.07s | 0.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.