Skip to content

Instantly share code, notes, and snippets.

@kamontat
Created July 20, 2023 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamontat/bc56aebe5f451adc85f15d2782077ce8 to your computer and use it in GitHub Desktop.
Save kamontat/bc56aebe5f451adc85f15d2782077ce8 to your computer and use it in GitHub Desktop.
{
"name": "test",
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.3.0",
"@fortawesome/free-solid-svg-icons": "^6.2.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@next/font": "13.1.6",
"@react-google-maps/api": "^2.18.1",
"@types/braintree-web-drop-in": "^1.28.0",
"@types/google.maps": "^3.51.0",
"@types/lodash": "^4.14.191",
"@types/node": "18.14.0",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"braintree-web-drop-in": "^1.33.4",
"dayjs": "^1.11.7",
"dotenv": "^16.0.3",
"eslint": "8.34.0",
"eslint-config-next": "13.1.6",
"express": "^4.18.2",
"framer-motion": "^6.2.7",
"js-cookie": "^3.0.1",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.19",
"next": "13.1.6",
"node-fetch": "^2.6.7",
"polished": "^4.2.2",
"prom-client": "^14.2.0",
"prop-types": "^15.7.2",
"rc-slider": "^10.1.0",
"react": "18.2.0",
"react-datepicker": "^4.6.0",
"react-dom": "18.2.0",
"react-draggable": "^4.4.5",
"react-helmet": "^6.1.0",
"react-intersection-observer": "^9.4.3",
"react-modal": "^3.15.1",
"react-remove-scroll": "^2.5.5",
"react-scroll": "^1.8.9",
"sanitize-html": "^2.8.1",
"sharp": "^0.32.0",
"string-similarity": "^4.0.4",
"typescript": "4.9.5",
"ua-parser-js": "^1.0.35",
"ulid": "^2.3.0",
"uuid": "^9.0.0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.19.1",
"@babel/preset-react": "^7.18.6",
"@next/eslint-plugin-next": "^13.2.3",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@trivago/prettier-plugin-sort-imports": "^3.4.0",
"@types/express": "^4.17.17",
"@types/jest": "^29.2.3",
"@types/js-cookie": "^3.0.2",
"@types/node-fetch": "^2.6.2",
"@types/react": "^18.0.25",
"@types/react-datepicker": "^4.8.0",
"@types/react-dom": "^18.0.9",
"@types/react-helmet": "^6.1.6",
"@types/react-modal": "^3.13.1",
"@types/react-scroll": "^1.8.7",
"@types/react-test-renderer": "^18.0.0",
"@types/sanitize-html": "^2.8.0",
"@types/string-similarity": "^4.0.0",
"@types/ua-parser-js": "^0.7.36",
"@types/uuid": "^9.0.1",
"@typescript-eslint/eslint-plugin": "^5.46.0",
"@typescript-eslint/parser": "^5.46.0",
"autoprefixer": "^10.4.1",
"cypress": "^11.2.0",
"cypress-cucumber-preprocessor": "^4.3.1",
"cypress-plugin-tab": "^1.0.5",
"del": "^7.0.0",
"eslint": "^8.8.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"jest-extended": "^3.2.1",
"mochawesome": "^7.1.3",
"postcss": "^8.4.5",
"prettier": "^2.5.1",
"react-test-renderer": "^18.2.0",
"tailwindcss": "^3.0.9",
"timezone-mock": "^1.3.6",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "4.8.3"
}
}

Npm vs Pnpm

Using package.json file to install using npm and pnpm command. This separate to 3 scenario: fresh install, no node_modules, and with node_modules

version

MacBook: 13-inch, M1, 2020 16GB MacOS: 13.4.1 (22F82) NodeJS: v18.16.1 Npm: 9.5.1 Pnpm: 8.6.7

Fresh install

Fresh install will install from directory that contains only package.json (no caches nor lock file).

Npm

Command

time npm install

Result

reference: https://app.warp.dev/block/pURqfKRL88GWtlP1DgxUIv

Total usage time: 1m7.65s

Pnpm

Command

rm -r /tmp/.pnpm-store
time pnpm \
  --store-dir /tmp/.pnpm-store \
  --loglevel warn install

Result

reference: https://app.warp.dev/block/62Oq5acKquq14GVb5tvPrt

Total usage time: 52.198s

Without node_modules

This run without node_modules, but might include caches (if any).

Npm

Command

rm -r node_modules
time npm install

Result

reference: https://app.warp.dev/block/OfKnsDcDEWAJp4gjQgdzi1

Total usage time: 11.39s

Pnpm

Command

rm -r node_modules
time pnpm \
  --store-dir /tmp/.pnpm-store \
  --loglevel warn install

Result

reference: https://app.warp.dev/block/6g7AJcbxvYEcDfITPZwu1I

Total usage time: 10.254s

With node_modules

This simulate seconds run on installed package.

Npm

Command

time npm install

Result

reference: https://app.warp.dev/block/7Ib6sztjs78HSpaaTUDIwm

Total usage time: 2.064s

Pnpm

Command

time pnpm \
  --store-dir /tmp/.pnpm-store \
  --loglevel warn install

Result

reference: https://app.warp.dev/block/7IapuYqh3YHXaI5LXF4jlE

Total usage time: 0.743s

Summary

On all tests, pnpm is faster than npm.

Testcase Npm Pnpm % Diff
Fresh install 1m7.65s 52.198s 29.60%
Without node_modules 11.39s 10.254s 11.08%
With node_modules 2.064s 0.743s 177.79%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment