Skip to content

Instantly share code, notes, and snippets.

@JLarky
Created September 3, 2023 01:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JLarky/111c7bc277a87cc5a07fb5e1d7b77ddb to your computer and use it in GitHub Desktop.
Save JLarky/111c7bc277a87cc5a07fb5e1d7b77ddb to your computer and use it in GitHub Desktop.
Initializing Next.js project with different package managers

Comparing install speed with cached deps

image

lower is better

Data

NPM

time npx create-next-app@latest my-app$((++x)) --ts --eslint --tailwind --src-dir src --app --import-alias "@/*"

real    0m4.402s
user    0m4.972s
sys     0m2.669s

real    0m4.589s
user    0m5.036s
sys     0m2.753s

real    0m4.472s
user    0m4.985s
sys     0m2.717s

Yarn

time yarn create next-app my-app$((++x)) --ts --eslint --tailwind --src-dir src --app --import-alias "@/*"

real    0m6.903s
user    0m3.278s
sys     0m4.578s

real    0m7.514s
user    0m3.353s
sys     0m4.611s

real    0m6.679s
user    0m3.309s
sys     0m4.569s

pnpm

time pnpm create next-app my-app$((++x)) --ts --eslint --tailwind --src-dir src --app --import-alias "@/*"

real    0m6.818s
user    0m3.829s
sys     0m19.987s

real    0m7.335s
user    0m3.798s
sys     0m18.282s

real    0m6.696s
user    0m3.813s
sys     0m19.123s

Bun

time bunx create-next-app my-app$((++x)) --ts --eslint --tailwind --src-dir src --app --import-alias "@/*"

real    0m0.621s
user    0m0.113s
sys     0m0.366s

real    0m0.619s
user    0m0.116s
sys     0m0.368s

real    0m0.712s
user    0m0.114s
sys     0m0.371s

graph source

https://chat.openai.com/share/344bb92c-8eb1-48e5-b372-047d2e8ebc9a

@xHyroM
Copy link

xHyroM commented Sep 3, 2023

You should use hyperfine for more accurate benchmark

@JLarky
Copy link
Author

JLarky commented Sep 3, 2023

You should use hyperfine for more accurate benchmark

It's good enough 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment