07 สิงหาคม 2562

npm vs yarn 2019 which javascript package manager is faster?

Test environment
  • device: MacBook Air 2017
  • node version: 12
  • yarn version: 1.17.3
  • npm version: 6.3.0
  • test datetime: 7 Aug 2019 00:30 A.M. Bangkok time


Internet speed https://speedtest.trueinternet.co.th)




Sample package.json

{
"name": "demo-app-react",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.19.0",
"node-sass": "^4.12.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-router-dom": "^5.0.1",
"react-scripts": "3.0.1"
}
}



Test yarn performance scenario
  1. remove node_modules
  2. remove yarn.lock
  3. measure yarn speed by running => start=$(date +'%s') && yarn && echo "It took $(($(date +'%s') - $start)) seconds"



Test npm performance scenario
  1. remove node_modules
  2. remove package-lock.json
  3. measure yarn speed by running => start=$(date +'%s') && npm i && echo "It took $(($(date +'%s') - $start)) seconds"



Result

Package manager / Speed (seconds) Round 1 Round 2 Round 3
npm 104 72 72
yarn 200 171 157


ไม่มีความคิดเห็น:

แสดงความคิดเห็น

บทความยอดนิยม (ล่าสุด)

บทความยอดนิยม (1 ปีย้อนหลัง)