Bun rewrote 535,496 lines of Zig into Rust using AI-assisted Claude Code workflows. The migration reportedly took 11 days, used around 64 concurrent AI agents at peak, produced 6,778 total commits, with 6,502 excluding merge commits, and consumed approximately $165,000 of model tokens at API pricing.
Was the rewrite actually worth it?
In this video, I break down the complete engineering story behind Bun’s Zig-to-Rust migration: why Bun wanted stronger memory-safety guarantees, how the AI workflow was organized, why the Rust compiler and Bun’s test suite mattered more than raw code generation, what improved, what went wrong, and why Zig creator Andrew Kelley challenged parts of Bun’s explanation.
This is not a “Rust killed Zig” video.
Zig helped make Bun possible. Rust was chosen for a later stage of the project, where production stability, automatic cleanup, bounds checks and long-term maintainability became more important.
━━━━━━━━━━━━━━━━━━━━━━━━━━━
🤝 PARTNER
━━━━━━━━━━━━━━━━━━━━━━━━━━━
→ CodeCrafters — Build your own Redis, Git, Shell & more in Rust:
https://app.codecrafters.io/join?via=...
━━━━━━━━━━━━━━━━━━━━━━━━━━━
⏱️ TIMESTAMPS
━━━━━━━━━━━━━━━━━━━━━━━━━━━
00:00 — 535,496 lines, 64 AI agents, 11 days
02:08 — Partner — CodeCrafters
04:24 — What Bun actually is
06:20 — Why Bun wanted to leave Zig
09:21 — This was not one AI prompt
11:46 — How adversarial AI review worked
14:35 — The test suite was the real foundation
17:19 — What actually improved in Rust
20:30 — The real cost and remaining technical debt
23:08 — The Zig creator's technical response
26:01 — What this proves about AI coding
28:51 — Was the rewrite worth it?
31:28 — Aarambh AI
31:58 — What happens next
33:23 — Final conclusion
━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 KEY REPORTED NUMBERS
━━━━━━━━━━━━━━━━━━━━━━━━━━━
• Original Bun codebase: 535,496 lines of Zig, excluding comments
• Duration: 11 days from May 3 to May 14, 2026
• Peak AI concurrency: approximately 64 Claude agents
• Dynamic workflows: around 50 running continuously
• Commits: 6,778 total; Bun’s replay counted 6,502 excluding merges
• Files mechanically ported: 1,448 Zig files
• Known rewrite regressions: 19, reported fixed
• Existing bugs fixed in Bun v1.4: 128, according to Bun
• Unsafe Rust: about 4% of the Rust code at the time of Bun’s report
• Linux binary: 88 MB to 70 MB after the rewrite and related optimizations
• Repeated-build memory test: about 6.7 GB versus about 609 MB after 2,000 builds
• Selected benchmark gains reported by Bun: approximately 2% to 5%
• Claude Code Linux startup telemetry: 517 ms to 464 ms median
All benchmark and migration numbers above are reported by Bun. They are not independent benchmarks.
━━━━━━━━━━━━━━━━━━━━━━━━━━━
❓ QUESTIONS ANSWERED
━━━━━━━━━━━━━━━━━━━━━━━━━━━
• Why did Bun rewrite its codebase from Zig to Rust?
• Did AI really rewrite Bun in only 11 days?
• How did Bun coordinate 64 AI coding agents?
• How can teams review one million lines of AI-generated code?
• Did Rust make Bun faster and use less memory?
• What did the Zig creator criticize about the migration?
• Does this prove Rust is better than Zig?
• Can normal engineering teams reproduce Bun’s AI rewrite?
• What does Bun’s migration mean for the future of AI coding agents?
━━━━━━━━━━━━━━━━━━━━━━━━━━━
🧠 THE HONEST VERDICT
━━━━━━━━━━━━━━━━━━━━━━━━━━━
The rewrite appears worthwhile for Bun because it addressed a real stability problem and the project had unusually strong verification infrastructure.
It does not prove that every Zig project should move to Rust.
The repeatable lesson is not the prompt. It is the system: porting guides, specialized agents, independent adversarial review, compiler feedback, a language-independent test suite, cross-platform CI, sanitizers, fuzzing and production telemetry.
━━━━━━━━━━━━━━━━━━━━━━━━━━━
🦀 AARAMBH DEV HUB
━━━━━━━━━━━━━━━━━━━━━━━━━━━
More Rust systems and AI engineering:
→ GitHub: https://github.com/AarambhDevHub
→ Aarambh AI: https://github.com/AarambhDevHub/aara...
Join the community:
→ Discord: / discord
→ LinkedIn: / darshan-vichhi-rust-developer
Support the channel:
→ GitHub Sponsors: https://github.com/sponsors/aarambh-d...
→ Buy Me a Coffee: https://buymeacoffee.com/aarambhdevhub
→ Razorpay: https://razorpay.me/@aarambhdevhub
→ Fiverr: https://fiverr.com/s/XL1ab4G
━━━━━━━━━━━━━━━━━━━━━━━━━━━
📚 PRIMARY RESEARCH
━━━━━━━━━━━━━━━━━━━━━━━━━━━
Bun engineering report:
https://bun.com/blog/bun-in-rust
Bun documentation and repository:
https://bun.com/docs
https://github.com/oven-sh/bun
Anthropic’s Bun acquisition announcement:
https://www.anthropic.com/news/anthro...
Andrew Kelley’s technical response:
https://andrewkelley.me/post/my-thoug...
#Rust #Zig #Bun #AICoding #ClaudeCode #SystemsProgramming #RustLang #SoftwareEngineering #Programming #AarambhDevHub