Hosted by Ryan Peterman
Written by a model from the transcript; not yet reviewed.
Stephen Toub, a distinguished engineer at Microsoft, shares how he single-handedly rewrote a 400,000-line TypeScript codebase for the GitHub Copilot runtime into Rust in about 14 and a half weeks. He explains the motivations behind the port, primarily moving away from Node.js and V8 to achieve better performance, lower working sets, and greater embeddability across multiple language SDKs. Rather than doing a massive "rewrite the world" pause, Toub adopted an incremental approach, shipping roughly 130 pre-releases to production while agents ported the code piece by piece.
The conversation explores how Toub handled code review and correctness at scale, relying heavily on integration tests, end-to-end tests, and multi-model agentic reviews instead of reading every line manually. They discuss the total cost of the project, which involved about 136 billion tokens amounting to roughly $120,000 in public API pricing plus about three weeks of developer time. Finally, Toub reflects on his 25-year career at Microsoft, detailing what he learned from serving as a technical advisor to a VP and offering perspective on how young engineers should approach learning core principles in an AI-driven era.
The episode opens with the host introducing Stephen Toub and outlining the focus on porting a large codebase to Rust.
Stephen contrasts the incremental, daily‑release approach with a single‑shot rewrite, explaining trade‑offs and why the chosen path suited Copilot.
He shares how he experimented with Claude, GPT, and other models, switching to keep the AI productive and avoid frustration.
The importance of end‑to‑end tests, guardrails, and CI is highlighted as key to catching regressions during the port.
Stephen describes how AI agents reviewed PRs, how he guided them, and how he balanced automation with human oversight.
Stephen quantifies the benefits in performance and cost savings, and details the token and time costs of the port.
He reflects on how AI tools are making large migrations feasible, reducing costs, and changing how teams approach refactoring.
Ryan Peterman opens the episode, welcoming listeners to The Peterman Pod.
Stephen Toub discusses initial line‑count estimates and the surprise growth in TypeScript lines to be ported.
Toub explains how token costs were calculated, the unexpected bill size, and the importance of factoring growth rates.
The conversation turns to business value, ROI, and when a rewrite is justified.
Total Cost and Token Countdata
The entire codebase migration consumed roughly 136 billion tokens, coming out to about $120,000 at public model pricing, alongside about three weeks of the guest's distributed time.
Why Rewrite Copilot Runtime in Rustinsight
The guest explains that the Copilot runtime needed to move away from TypeScript and Node.js to a performance-oriented, highly embeddable language like Rust in order to support agentic loops across diverse environments.
Evaluating Alternatives to Ruststrategy
Before settling on Rust, prototypes were built in Python, Go, C#, Java, and Rust. C# with native AOT matched Rust's performance, but Rust was chosen due to existing GitHub projects and developer familiarity.
Incremental vs Big Bang Rewritesdebate
The guest contrasts his incremental porting approach with Bun's all-at-once rewrite. Because agentic harnesses change rapidly, pausing development for a massive rewrite risks shipping into an outdated world.
Handling Regressions During Migrationinsight
The guest discusses how end-to-end tests caught the majority of regressions, though some bugs still slipped through due to test gaps, concurrency differences, and agents altering test oracles.
Macro vs Micro Code Reviewstrategy
Reading every line of a massive rewrite is inefficient; the guest focused on high-level architecture, component boundaries, and direction, while relying on agents for line-by-line details.
Serving as a VP Technical Advisorstory
The guest describes his experience working as a technical advisor to a Microsoft VP as an intense, draining, but immensely educational look at how high-level corporate decisions are actually made.
“these projects that were once unaffordable are now quite doable in a very small period of time.”
“And there are plenty of concurrency bugs that slip through.”
“On a per request basis, that latency can be extremely measurable and extremely impactful for bottom line, if you're even able to adopt it.”
“it came out to approximately $120,000.”
“the majority of the new incoming code was Rust. But if you look at like the first half”
“it is, it would have been a monumental investment. And like I, I struggled to think about even writing that proposal because I know that it would be”
“It really comes down to what is the business value? I mean, there's, there's the ones you can do for fun where it's your dime and you get to decide”
“And this port is going to take a year and it's going to cost us a developer for that year. So they do the math and you know, this is absolutely worthwhile.”
“I still think it's valuable to learn and to start out with a language like C, because you're understanding how computers actually work”
Stephen Toub is a Distinguished Engineer at Microsoft who single-handledly rewrote the GitHub Copilot runtime (400,000-line codebase) in Rust. We talked about why/how he did it, how Rust compared with other languages, and everything he learned in the process. • My ergonomic keyboard project I mentioned, you can follow along here: https://read.compose.llc/ • The Kickstarter page for it: https://www.kickstarter.com/projects/ryanlpeterman/compose-simple-ergonomics-beautifully-done Podcast links: • YouTube: https://www.youtube.com/watch?v=PLMOVlZC4eU • Apple: https://podcasts.apple.com/us/podcast/the-peterman-pod/id1777363835 • Transcript: https://www.developing.dev/p/e073-stephen-toub Thank you to this episode's sponsor for supporting my work: • WorkOS: makes your app Enterprise Ready with easy to use APIs to add SSO, SCIM, RBAC, and more in just a few lines of code, check them out at https://workos.com/ Timestamps: (00:00) Intro (01:06) Why the Copilot runtime needed a Rust port (05:38) Why he chose Rust (11:28) Discussing rollout strategies (21:57) How he caught regressions (32:08) Guiding the agents (42:11) Catching regressions before prod (45:16) Which models he used (50:03) The end benefit and costs (01:03:24) When to do a full rewrite (01:06:40) Career learnings on the way to Distinguished (01:16:00) Top technical book recommendation (01:17:49) Advice for young engineers (01:21:00) Outro Where to find Stephen: • GitHub: https://github.com/stephentoub • X: https://twitter.com/stephentoub • LinkedIn: https://www.linkedin.com/in/stephen-toub-75979745/ Where to find Ryan: • Newsletter: https://www.developing.dev/ • X/Twitter: https://x.com/ryanlpeterman • LinkedIn: https://www.linkedin.com/in/ryanlpeterman/ • Threads: https://www.threads.com/@ryanlpeterman • Instagram: https://www.instagram.com/ryanlpeterman • TikTok: https://www.tiktok.com/@ryanlpeterman Referenced in this episode: • Stephen Toub’s post on porting the GitHub Copilot runtime to Rust: https://github.blog/ai-and-ml/generative-ai/migrating-the-github-copilot-runtime-to-rust-using-copilot/ • Jarred Sumner’s post on porting Bun to Rust: https://bun.com/blog/bun-in-rust • Code: The Hidden Language of Computer Hardware and Software: https://www.charlespetzold.com/code/index.html
13,018 words · 2 speakers
Speaker names marked are inferred from speaking time and the show’s known hosts — they are not voice-verified.
Page updated · transcript and summary are machine-generated