Open Moto42 opened 4 weeks ago
.devcontainer.json
{
"image": "oven/bun:alpine",
...
"postCreateCommand": "bun install",
"postAttachCommand": "bun run start"
}
delete package-lock.json
commit `bun.lock' to git
code to benchmark local in the devcontainer. From command line...
apk --update add npm hyperfine;
hyperfine --runs 10 "bun run build" "npm run build"
Benchmark results
Benchmark 1: npm run build
Time (mean ± σ): 2.270 s ± 0.016 s [User: 2.214 s, System: 0.608 s]
Range (min … max): 2.247 s … 2.295 s 10 runs
Benchmark 2: bun run build
Time (mean ± σ): 1.453 s ± 0.011 s [User: 1.404 s, System: 0.382 s]
Range (min … max): 1.435 s … 1.476 s 10 runs
Summary
'bun run build' ran
1.56 ± 0.02 times faster than 'npm run build'
Bun is fast, if the build phase will work in Bun and the install to the github runner doesn't take too long, switch to bun.