Preskočiť na obsah
en

2 min čítania

Bun 1.4 — rewritten in Rust, and lighter on its feet

Bun 1.4 swaps Zig for Rust, cuts idle CPU and memory, and ships built-in image processing, cron, parallel tests and a lot more.

  • bun
  • javascript
  • tooling
  • release

Tento článok je v angličtine.

Bun 1.4 landed on August 20 and is now at 1.4.2. The headline is under the hood: the runtime has been rewritten from Zig to Rust. The release notes say Claude Code has been running on the Rust port for months — the kind of production mileage that makes a rewrite of this size easier to trust.

Faster and leaner

The numbers from the release post:

  • Idle CPU about 5× lower for a hello-world server; production CPU for Claude Code roughly halved.
  • Up to 35% less memory, with HTTP server benchmarks dropping 13–48%.
  • About 2× faster startup on Linux — 5.1 ms versus 10.9 ms on Bun 1.3.
  • Web streams, TextEncoderStream/TextDecoderStream and CompressionStream are now native.

Node.js compatibility moved too: 1,517 more of Node's own tests pass, and Next.js 16, Playwright, Vitest and OpenTelemetry are listed as working. The team is upfront that it is still not 100% compatible.

More batteries included

The new built-ins replace dependencies many projects pull in by habit:

// Resize and re-encode an image — no sharp, no native addon
await Bun.file('photo.jpg')
  .image()
  .resize(1024, 1024, { fit: 'inside' })
  .webp({ quality: 85 })
  .write('thumb.webp')

// Register an OS-level scheduled job (crontab, launchd or Task Scheduler)
await Bun.cron('./worker.ts', '30 2 * * MON', 'weekly-report')

Alongside Bun.Image and Bun.cron there is Bun.markdown, a headless Bun.WebView, a Bun.Terminal pseudo-terminal for Bun.spawn, and parsers for JSON5, JSONL, XML and TOML. Bun.serve() can now serve a directory directly with Range and conditional requests handled for you.

Tests that scale with CI

bun test picked up the features teams usually reach for Jest or Vitest to get:

bun test --parallel --shard=1/3 --timings=timings.json

--parallel spreads files across workers, --shard splits them across CI machines, --timings balances by duration, --isolate gives each file a fresh global, and --changed runs only what your diff touches. test() also gained retry and repeats options for flaky-test hunting.

Package manager and bundler

bun audit fix, bun dedupe, bun prune, bun pm diff and bun pm licenses close most of the gaps with npm and pnpm, and bun update now updates transitive dependencies. The bundler can run the React Compiler without Babel (--react-compiler) and skip unused barrel re-exports with optimizeImports.

Check before you upgrade

There is no formal breaking-changes list, but a few defaults moved:

  • Bun.serve no longer serves sourcemaps for HTML routes in production.
  • file:, git: and github: dependencies must be in trustedDependencies to run install scripts, and ignoreScripts now wins over that list.
  • Bun.cron uses local time unless you pass { tz }.
  • Your lockfile gains SHA-512 hashes for GitHub and tarball dependencies on the next install — expect a lockfile diff.

Bottom line

If you already run Bun, upgrade: lower CPU and memory are free wins, and the test runner alone is worth it for larger suites. Run bun upgrade, check the four points above, and leave experimental HTTP/3 off in production for now. If you are on Node, 1.4 is the most convincing release yet to try Bun as a package manager and test runner first — the lowest-risk way in.

Kontakt

Staviate s tým niečo?

Pomáhame tímom vybrať správne nástroje a dotiahnuť produkt do konca. Napíšte nám, na čom pracujete.

Čo má robiť, pre koho je a je nejaký termín?

Vaše údaje použijeme len na odpoveď na váš dopyt. Viac v časti ochrana osobných údajov.