Comparing NPM vs Yarn speed

A long time ago, an analogue of npm appeared, Yarn is another client for managing npm packages, which was positioned as a super fast Facebook brand to replace npm.
 
 
If you are working on a large project, then the package recovery time is an important factor in the speed of development and the build project of ci.
 
 
It was decided to check whether to use Yarn as a replacement for Npm. since there are a lot of packages on weak build agents, recovery can take up to 2 minutes.
 
 
Comparing NPM vs Yarn speed
 
 
So, the test script is quite simple:
 
- Parallel launch of two[npm i и yarn inatall]restorations. from the same packages.json.
 
 
3r330. Content package.json [/b]
3r3334. {
"version": "???",
"name": "mir_scada2",
"private": true,
"dependencies": {
"angular": "^ ???",
"angular-animate": "^ ???",
"angular-bootstrap-checkbox": "^ ???",
"angular-bootstrap-contextmenu": "???",
"angular-file-upload": "???",
"angular-minicolors": "???",
"angular-moment": "???",
"angular-moment-picker": "???",
"angular-sanitize": "^ ???",
"angular-touch": "^ ???",
"angular-ui-bootstrap": "^ ???",
"angular-ui-grid": "^ ???",
"angular-ui-tree": "^ ???", 3r-3256. "angularjs-color-picker-vanilla": "???",
"bootstrap": "???",
"bootstrap3-dialog": "^ ???",
"chart.js": "???",
"copyfiles": "^ ???",
"core-js": "???",
"d3": "???",
"dom-to-image": "???",
"eonasdan-bootstrap-datetimepicker": "???",
"excel-builder": "^ ???",
"file-saver": "^ ???",
"html2canvas": "???-alpha.11",
"jquery": "???", 3r33256. "jquery-contextmenu": "^ ???", 3r-3256. "jquery-mask-plugin": "^ ???",
"jquery-minicolors": "^ ???", 3r-3256. "jquery-validation": "^ ???",
"jquery-validation-unobtrusive": "^ ???", 3r-3256. "jquery.cookie": "???",
"jquery.easing": "???",
"jquery.splitter": "???",
"jsrender": "???-rc.70",
"jszip": "^ ???",
"linq": "^ ???", 3r33256. "lodash": "^ ???",
"moment": "^ ???", 3r33232. "pdfjs-dist": "^ ???",
"popper.js": "???",
"respond": "???",
"rxjs": "???",
"rxjs-compat": "???",
"signalr": "^ ???",
"svg.js": "^ ???",
"ui-select": "^ ???",
"zone.js": "???"
},
"devDependencies": {
"@ types /angular-signalr-hub": "???",
"@ types /angular-ui-bootstrap": "???",
"@ types /bootstrap3-dialog": "???", 3r-3256. "@ types /chart.js": "???",
"@ types /d3": "???",
"@ types /d3-shape": "???",
"@ types /dom-to-image": "???",
"@ types /flot": "???",
"@ types /html-webpack-plugin": "???",
"@ types /jquery": "???",
"@ types /lodash": "???",
"@ types /mini-css-extract-plugin": "???",
"@ types /node": "12/10/14",
"@ types /signalr": "???",
"@ types /sweetalert": "???", 3r-3256. "@ types /webpack": "???",
"angular2-template-loader": "???",
"awesome-typescript-loader": "???", 3r-3256. "babel-core": "^ ???",
"babel-loader": "^ ???",
"babel-preset-env": "^ ???",
"cache-loader": "^ ???",
"cli": "???",
"css-loader": "???",
"cssnano": "???",
"exports-loader": "???",
"expose-loader": "???",
"file-loader": "^ ???",
"filemanager-webpack-plugin": "???",
"hard-source-webpack-plugin": "???",
"html-loader": "???",
"html-webpack-bom-plugin": "???",
"html-webpack-plugin": "???-alpha",
"imports-loader": "???",
"less": "^ ???",
"less-loader": "^ ???",
"mini-css-extract-plugin": "^ ???", 3r-3256. "optimize-css-assets-webpack-plugin": "???",
"postcss-import": "^ ???",
"postcss-loader": "^ ???",
"postcss-preset-env": "^ ???", 3r-3256. "speed-measure-webpack-plugin": "^ ???",
"style-loader": "^ ???",
"terser-webpack-plugin": "???",
"ts-node": "???",
"typescript": "???",
"webpack": "???", 3r33232. "webpack-cli": "???",
"webpack-dev-server": "^ ???",
"webpack-notifier": "???"
},
"scripts": {
"mir_web_components @ latest": "npm i mir_web_components @ latest -save",
"globalInstall": "npm i -g webpack webpack-cli cross-env karma [email protected]???",
"webpack": "tsc --lib es? dom webpack.config.ts && cross-env NODE_OPTIONS = - max_old_space_size = 4000 webpack --mode development --config ./webpack.config.js"
},
"-vs-binding": {
"~ BeforeBuild":[
"install",
"webpack"
]
}
}
3r3154.
 
 
 
The first result of installing packages surprised: 3r3-3199. npm 77 seconds, yarn 109 seconds. [/b]
 
 
3r3172.
 
 
The second result was similar: 3r3-3199. npm 76 seconds, yarn 102 seconds [/b]
 
 
3r3190.
 
 
Also interesting was the size of the downloaded packages: 3r3-33199. npm 350mb vs yarn 255mb [/b]
 
 
3r3208.
 
 
One of the drawbacks revealed in the course of working with yarn was that when you remove packages with handles from node_modules, the yarn install command does not restore deleted packages.
 
 

 
 
In the course of the mini-tests, it was not possible to reveal the victory of yarn, except in the case of the restoration of 3r33239.[1] [/i] packages.
 
 
[1] Plus Yarn can be attributed to the rapid recovery of packages, i.e. if the packages were not removed by pens, but the versions in package.json were simply changed
 
 

 
 
I will be glad to constructive suggestions about the correctness of the assessment of the speed of work of yarn and npm in the comments.
+ 0 -

Add comment