Microsoft has announced that it has ported the runtime of its GitHub Copilot to Rust, achieving a significant speedup and reduction in memory usage. The migration, which was done largely by AI agents, cost around $120,000 and took approximately three weeks of developer time.
The effort involved updating the runtime module-by-module over a period of 14.5 weeks, with roughly 1.3 port pull requests opened per day. The AI agents converted 430,000 lines of TypeScript into 800,000 lines of production Rust, with the port only replacing TypeScript modules on a case-by-case basis.
The results were impressive, with one benchmark showing a 15.9x speedup in completing 1,000 one-turn session lifecycles. The original TypeScript implementation completed 7.55 lifecycles per second, while the Rust rewrite managed 120 per second. In terms of memory usage, a 10-client batch of agents consumed 1,383 MB with TypeScript, while the Rust rewrite consumed only 126 MB serving the same swarm.
According to Microsoft Distinguished Engineer Stephen Toub, the project used Copilot to rewrite Copilot, with several large language models (LLMs) used to execute different parts of the job. The LLMs, including GPT-5.6 Sol and Claude Opus 4.8, were used to gather information, form hypotheses, and make targeted changes to the code.
While the use of AI agents was largely successful, Toub noted that they spent more time gathering information than actually writing code. The agents also showed emergent behaviors, such as interacting with other sessions and requesting coordination. However, the project also encountered dozens of regressions within the code, highlighting the challenges of using Rust and the importance of treating the compiler as a teacher rather than an oracle.
The porting process has significant implications for the use of Rust in large-scale applications. As Toub noted, Rust's performance benefits make it an attractive choice for rewriting applications, but its complexity and nuances require careful consideration. The project's success demonstrates the potential of using AI agents to drive significant improvements in software development, but also highlights the need for careful evaluation and testing to ensure that the resulting code is correct and efficient.
Questo articolo è stato scritto con l'assistenza dell'IA.
News Factory APP - notizie agentiche per potenziare il tuo SEO e AEO.
