2023-09-12 05:06:58
Bun vs pnpm
I'm seeing a lot of bun vs pnpm install speed comparisons but would like to provide some nuance: the absurd perf difference usually is a result of one tool running with a network API call overhead, while the other not.
bun install defaults to the behavior similar to pnpm's --prefer-offline flag, which skips hitting the npm API. To simulate the default behavior of pnpm, you have to use bun --force.
Here are some comparisons on my machine (network from Singapore) with different conditions:
bun (no cache, no lockfile): 5.4s
pnpm (no cache, no lockfile): 6.7s
bun (with cache, no lockfile): 30ms
pnpm (--prefer-offline, with cache, no lockfile): 587ms
bun (--force, with cache, no lockfile): 2.73s
pnpm (with cache, no lockfile): 5.9s
bun is still faster, but not so significant as some benchmark graphs may have led you to believe.
bun itself is amazing in many ways and deserve hype, but I'd love to see we compare apples to apples and not gloss over the details for engagement.
context for the benchmark: it's using the Vite + Vue + TypeScript boilerplate generated from bun create vite.
- Evan You (https://twitter.com/youyuxi/status/1701243745880932687)
Follow @javascriptdaily
6.5K views02:06