Moto42 / elevendycap

0 stars 0 forks source link

Investigate switching to bun. #17

Open Moto42 opened 4 weeks ago

Moto42 commented 4 weeks ago

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.

Moto42 commented 4 weeks ago

Changes to switch local dev to bun...

.devcontainer.json

{
  "image": "oven/bun:alpine",
  ...
  "postCreateCommand": "bun install",
  "postAttachCommand": "bun run start"
}

delete package-lock.json commit `bun.lock' to git

local benchmarks

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'