← All posts

Bun 1.4: Rust runtime, closer Node.js compatibility, less memory

+1,517 Node tests, up to 35% less memory, ~2× faster Linux startup—first stable release after the Zig→Rust rewrite.

Bun 1.4: Rust runtime, closer Node.js compatibility, less memory
Contents

In brief

Bun 1.4 is the first stable release after rewriting the runtime from Zig to Rust. It adds 1,517 passing Node.js test-suite cases, closes 2,900+ issues, cuts idle CPU up to 5×, trims HTTP server memory 13–48%, and starts ~2× faster on Linux. New surface area includes Bun.Image, Bun.WebView, Bun.cron(), parallel bun test / bun run, and broader package compatibility.

What happened

Bun markets itself as a full JS/TS toolkit. In 1.4 the headline is the language swap: 1.3.14 was the last Zig build; 1.4 ships on Rust (see «Rewriting Bun in Rust»). Execution still uses JavaScriptCore; the rewrite covers HTTP, bundler, package manager, and filesystem layers.

Node compatibility jumped: node:http / fs / stream near 97% of Node’s own tests; some modules hit 100%. Playwright, vitest, OpenTelemetry, dd-trace, Nuxt HMR, and more npm packages work better. Native web streams claim 100% Web Platform Tests on the published pipelines.

Resources: Claude Code production p99 CPU fell ~24% → 10%; hello-world idle CPU up to 5× lower. Under 1M requests Fastify on Bun 1.4 used 120 MB vs 233 MB on 1.3. Linux hello.js startup: 5.1 ms vs 10.9 ms. Profiling gained --cpu-prof / --heap-prof plus Markdown variants for SSH, and process.on("memoryPressure").

Why it matters

Bun has competed with Node as the “fast runtime.” 1.4 hits three production pains at once: ecosystem compatibility, long-lived process memory, and observability. The Rust move is a bet on memory safety tooling (Miri, sanitizers, fuzzing), not only speed marketing.

Upgrade consciously: release notes list behavior breaks (including YAML 1.2—GitHub Actions on: may parse as a string). Vercel Functions already expose 1.4 via explicit bunVersion.

In practice

  1. bun upgrade, then run the full test suite—not just “server boots.”
  2. Read breaking changes: YAML, Node 26 edges, stream behavior.
  3. If you serve HTTP on Bun, measure RSS before/after; expect double-digit percent drops.
  4. For headless servers, try --cpu-prof-md / --heap-prof-md.
  5. On Vercel set "bunVersion": "1.4.x" in vercel.json only after checking breaks.

Takeaway

Bun 1.4 pairs a language rewrite with a real Node-compat jump and leaner memory. Stage it; don’t Friday-ship without a rollback plan.