A production language runtime has been rebuilt in 832,378 lines of Rust, replacing TypeScript, and the performance delta is stark: a benchmark of 1,000 one-turn session lifecycles climbed from 7.55 per second to 120, while memory for a 10-client agent batch fell from 1,383MB to 126MB. The work ran from May 12 to August 21, 2026, was driven primarily by one developer supervising coding agents, and is documented in a detailed engineering write-up by Microsoft Distinguished Engineer Stephen Toub.
Key takeaways
- Agents converted roughly 430,000 lines of production TypeScript into 832,378 lines of Rust across 128 merged pull requests over 14.5 weeks.
- A benchmark running 1,000 one-turn session lifecycles went from 7.55 per second on TypeScript to 120 per second on in-process Rust, while a 10-client agent batch dropped from 1,383MB to 126MB of memory.
- Of 31,247 user messages in the session logs, only about 2,600 were typed by a human โ roughly one in twelve.
The numbers behind the port
Alongside the production code, agents produced 468,689 lines of Rust unit tests. Port pull requests landed at about 1.3 per day while 135 public releases shipped around them, because modules were replaced in place rather than in one cutover. The Register reported the token bill at roughly $120,000.
Temporary scaffolding tells the same story: N-API exports bridging the two worlds peaked at 2,019 on August 3, alongside 3,356 TypeScript call sites. Both ended at zero.
What this runtime actually powers
The engine is invisible to most people who touch it. It backs the Copilot CLI, the Copilot desktop app, the Copilot SDK in six languages, and the cloud agent, and it ships inside recent releases of VS Code and Visual Studio. It also reaches into Excel, Outlook, PowerPoint and Word.
The original build ran TypeScript on Node.js with V8 โ fast to iterate on, but weak on startup latency and server density once the same engine had to be embedded through a C ABI in that many hosts. Toub was careful to bound the conclusion, writing that the project is in no way a claim that every large TypeScript program should become Rust, and that the requirements here emphasized C ABI embedding, low steady-state overhead and predictable resource use.
Why the agents spent more time reading than writing
The logs recorded 12,760,995 events and 1,857,409 tool starts. Git inspection commands alone consumed 608 measured hours. The prompt-cache hit rate reached 96.22%, without which sessions of that length would have been unaffordable.
The popular image of AI spewing code is almost backwards; at this scale, the work looked much more like iterative investigation.
The port of session.ts, a 30,000-line file touching every part of the runtime, took a 25-hour session that opened with 56 minutes of reading and 122 clarifying tool calls before a single edit. It then spawned 15 child sessions in seven waves and exchanged 89 coordination messages with them. Different models were assigned by strength, with GPT-5.6 Sol and Anthropic's Claude Opus 4.8 both used.
What the compiler could not catch
The borrow checker, the part of Rust that dominates every difficulty conversation, barely registered. Of 8,678 compiler errors, ownership, borrowing and lifetime issues accounted for 1.7%, while name and import resolution made up 37%. Unsafe code stayed contained at 158 blocks across 36 files, nearly all of it at C ABI, Windows API and POSIX boundaries.
The regressions were another matter. Dozens were traced, mostly surfacing in pre-release channels, and were not fully cleared until September 14. They clustered into incomplete migrations, state and lifetime issues, behavioural contract mismatches, host boundary problems and incorrect test oracles โ none of which a compiler evaluates. At RustConf in Montrรฉal, consultant Lisa Crossman warned against treating the compiler as an oracle, noting that Rust stops an agent from writing memory-unsafe code but not from writing the wrong program correctly. Toub reached a similar place, calling the idea that compiling code is correct code useful only as a joke.
Outlook
The comparison case is Bun, the Anthropic-owned JavaScript runtime, where creator Jarred Sumner moved roughly 535,000 lines of Zig to Rust almost entirely with Claude agents; the experimental port was passing 99.8% of Bun's tests on Linux x64 glibc by July 30, though stable builds still ship from Zig and Zig creator Andrew Kelley dismissed the output as unreviewed slop. GitHub took the opposite tack, replacing modules one-for-one without restructuring anything โ which means the actual optimization work has not started yet. The pattern echoes a similar two-engineer Rust rewrite at OpenAI: small human teams, enormous agent throughput, and review as the remaining bottleneck.
FAQ
Did AI agents write all of the Rust code?
Agents produced most of it, but humans stayed in the loop on design, review and final decisions. The session logs show roughly 2,600 human-typed messages against 31,247 total user messages, meaning a person intervened about once every twelve turns.
How much faster is the Rust runtime?
On one published benchmark measuring 1,000 one-turn session lifecycles with a shared client and 100 concurrent pipelines, the Rust build reached 120 lifecycles per second against 7.55 for TypeScript, a 15.9x gain. Memory for a 10-client agent batch fell from 1,383MB to 126MB.
Should other TypeScript projects migrate to Rust?
Toub explicitly declined to generalize. The case for Rust here rested on embedding through a C ABI, low startup cost and predictable resource use across many host applications โ requirements most TypeScript codebases do not have.






