Rewriting Bun in Rust

Context of the Rewrite & Process

  • Bun was ported from Zig to Rust largely via Anthropic’s Fable model and Claude Code, over ~11 days, using ~50+ automated workflows and extensive test suites.
  • The rewrite is presented as mostly mechanical, function‑by‑function, with structure and data models preserved, then iteratively refined via adversarial AI reviews and human oversight.
  • The Rust version has already been running in production for Claude Code since mid‑June without obvious catastrophic failures, which some see as strong validation.

Cost and Economics

  • Token spend was ~5.9B uncached input, 72B cached input, 690M output tokens, estimated at ~$165k at API pricing.
  • Many argue this is cheaper and much faster than a small team spending a year; others counter that human teams (especially outside high‑cost regions) or weaker/cheaper models might match this at lower total cost.
  • Some note that even if this is expensive now, similar rewrites will likely get much cheaper.

Code Quality, Safety, and Maintainability

  • Reported benefits: fixed memory leaks, fewer crashes, ~20% binary size reduction (with linker optimizations), ~5% performance gains.
  • Supporters say Rust’s guarantees, compiler errors, and Miri/memory tooling give stronger safety than Zig plus style guides.
  • Critics highlight large unsafe usage (~13k instances early on), initial UB found by Miri, and argue that many unsafe blocks and weak SAFETY comments suggest misunderstood Rust invariants.
  • There is disagreement over whether AI‑generated code at this scale is truly “maintainable” or just appears stable under tests.

Impact on Zig and Language Debates

  • Some see this as bad optics for Zig: a “naive” port away from it seemingly improved stability and size.
  • Others stress Bun’s Zig code was written against an evolving pre‑1.0 language and that similar gains were possible by tightening Zig code and tooling.
  • Long subthreads debate Rust vs Zig vs C/C++ vs GC languages on safety, ergonomics, compile times, and suitability as LLM targets.

AI Tooling, “Vibe Coding”, and Future of Work

  • Many view this as a showcase of LLM‑assisted large‑scale translation when backed by a strong, language‑independent test suite.
  • Some call the process “vibe coding” (LLM‑driven without exhaustive human review); others argue translation with tests is distinct from unconstrained, speculative AI development.
  • There is active anxiety about what such capabilities mean for software jobs, especially mid‑tier roles; others expect Jevons‑style effects (more software produced, not fewer engineers).

Project Governance & Community Concerns

  • Several commenters criticize how the rewrite was communicated and merged:
    • Early assurances that the Rust branch might be thrown away vs rapid merge later.
    • No LTS or security‑fix plan for the Zig line, effectively forcing upgrades.
    • Perception that Bun is steered more by Anthropic’s marketing and internal needs than by its external community.
  • Supporters respond that pre‑merge code is supposed to be rough, regressions were documented and fixed, and results for users appear positive so far.