Npm vs Yarn install speed testing.
Yarn is a new package manager for JavaScript. Please read blog post from Facebook for detail information.
You can testing in Docker or what you prefer.
- node version:
v10.11.0
- npm verison:
6.4.1
- yarn verison:
1.9.4
Testing install speed without cache node_modules
folder.
$ rm -rf ~/.npm/_cacache/
$ time npm install
time: 3m40.155s
Try npm ci command
$ rm -rf ~/.npm/_cacache/
$ time npm ci
time: 3m10.783s
$ yarn cache clean
$ time yarn install
time: 1m1.261s
Testing install speed without include cache node_modules
folder.
$ rm -rf node_modules
$ time npm install
time: 1m1.195s
Try npm ci command
$ rm -rf node_modules
$ time npm ci
time: 0m18.030s
$ rm -rf node_modules
$ time yarn install
time: 0m30.571s
Testing install speed with cache node_modules
folder.
$ time npm install
time: 0m54.944s
$ time npm ci
time: 0m21.810s
$ time yarn install
time: 0m2.109s
Date: 2018-10-02
Yarn is faster than npm. We can move package manager from Npm to Yarn for JavaScript now.
npm install | npm ci | yarn | |
---|---|---|---|
install without cache (without node_modules) | 3m | 3m | 1m |
install with cache (without node_modules) | 1m | 18s | 30s |
install with cache (with node_modules) | 54s | 21s | 2s |
install without internet (with node_modules) | - | - | 2s |