Microsoft Engineers Invest $120,000 in AI to Overhaul Copilot Runtime: 430,000 Lines of TypeScript Reimagined as 800,000 Lines of Rust, Achieving 15.9-Fold Speed Increase
4 day ago / Read about 0 minute
Author:小编   

Microsoft leveraged AI agents to undertake a comprehensive rewrite of the TypeScript+Node.js runtime—a foundational component underpinning various GitHub Copilot offerings, as well as Microsoft's broader software and cloud services ecosystem—into Rust. Remarkably, this ambitious endeavor incurred token costs of just $120,000 and was accomplished by a lone engineer within a mere three-week timeframe. In stark contrast, conventional manual rewriting approaches would have necessitated years of effort and incurred costs running into the millions of dollars.

Throughout the migration process, a staggering 430,000 lines of TypeScript code were meticulously transformed into 800,000 lines of robust, production-ready Rust code. This transformation spanned 135 distinct versions over a period of 14.5 weeks. From a performance standpoint, the revamped version demonstrated a remarkable up to 15.9-fold increase in processing speed for single-round conversations compared to its predecessor, while simultaneously achieving significant reductions in memory consumption.

This migration project underscores the iterative and exploratory nature of AI-driven programming, which transcends mere rapid code generation. It also brought to light certain challenges associated with AI-generated Rust code: although it effectively sidesteps memory safety pitfalls, it is susceptible to functional regressions, thereby necessitating human oversight to guarantee semantic accuracy.

Previously, the creator of Bun also employed Claude agents to migrate the JS runtime from Zig to Rust, incurring token costs of $165,000 and attaining a 99.8% pass rate in subsequent tests. However, this initiative drew criticism from the founder of Zig concerning the resultant code quality.