Skip to content

root / tags / bun

#Bun

2 fiches

AI Coding Agents & Skills Auto-verified translation

Rewriting Bun in Rust

First-rate technical account by **Jarred Sumner**, creator of **Bun** (JS/TS runtime, >22M downloads/month), on the **complete rewrite of Bun from Zig to Rust in 11 days** (May 3→14, 2026) driven by **Claude** — an exceptional case study in AI-assisted software engineering **at industrial scale**. Motivation: a recurring class of bugs (use-after-free, double-free, leaks) arising from the mix of GC-managed memory (JavaScriptCore) and manual memory (Zig); in **safe Rust**, these bugs become **compile errors** with automatic cleanup (`Drop`/RAII) — "a better feedback loop than a style guide." Rejecting the dogma that "a rewrite is always a bad idea" (a year of bugfix freeze for 3 engineers), Sumner chooses a **mechanical port** (preserve the architecture, minimal behavior change) validated by the **existing test suite, written in TypeScript and therefore language-independent** (60,624 tests, 1.39M `expect()` assertions, 0 tests removed, 6 platforms). The harness: **~50 dynamic workflows** in **Claude Code**, *write → 2+ adversarial reviewers → apply* loops, up to **64 Claude instances in parallel** (4 worktrees × 16), with **PORTING.md** + **LIFETIMES.tsv** generated in preparation. Numbers: **6,502 commits** (peak 695/h, 58/min, ~1,300 lines/min), final diff **+1,009,272 lines**, ~16,000 compile errors treated as a queue, **5.9B uncached input tokens + 690M output ≈ $165,000**. Key methodological levers: **adversarial review** (a second Claude, separate context, sees only the diff, tasked with finding why it's wrong — catches subtle bugs that are *semantically* different but *syntactically* identical) and the principle **"fix the process that generates the code, not the code by hand."** Model used: a pre-release of **Claude Fable 5** (Mythos class). Since the merge: **11 rounds of Claude Code security review**, 24/7 coverage-guided fuzzing (100B executions → ~15 PRs), **4% `unsafe` code** (78% on a single line), **19** known regressions fixed. In production: Claude Code v2.1.181, the first release on Bun-in-Rust, **+10% faster startup on Linux**. Disclosed upfront: **Bun was acquired by Anthropic in December 2025**.

#Bun#Jarred Sumner#Zig-to-Rust rewrite

Jarred Sumner (créateur de Bun ; travaille chez Anthropic depuis le rachat de Bun en décembre 2025)

Architecture & Construction Auto-verified translation

HOW CLAUDE CODE IS BUILT

Building Claude Code - AI-first Architecture - Product Engineering - Pragmatic Engineer

#Claude Code#Anthropic#AI

Gergely Orosz (auteur de l'article) · Boris Cherny · Sid Bidasaria · Cat Wu (équipe fondatrice de Claude Code)