In the dynamic world of software development, speed can be a defining factor in productivity and innovation. Recently, a groundbreaking development emerged that promises to transform how we approach TypeScript compilation. A fully compatible TypeScript compiler written in Rust has arrived, and it’s turning heads by being nearly three times faster than its Go counterpart. This revelation is a testament to the increasing influence of Rust in the tech industry and its potential to enhance performance drastically.
To contextualize this remarkable feat, it’s important to understand what a TypeScript compiler does. Essentially, it handles two primary tasks: type checking and converting TypeScript code into JavaScript. The latter process is typically swift, thanks to tools like ESB build that simply strip out types, but it’s the type checking that can slow things down immensely on large codebases. Enter the new Rust and Go compilers, specifically engineered to expedite the sluggish type-checking process.
Based on content from Better Stack
Our experiments comparing JavaScript, Go, and Rust compilers revealed significant differences in processing times. Utilizing the TypeScript repository with 793 files and approximately 380,000 lines of code, the benchmarks were telling. In scenarios with valid types and various error conditions, JavaScript consistently lagged, while Go showed substantial improvements, taking seconds compared to JavaScript’s seven-second average. However, Rust stole the spotlight, showcasing a staggering speed that overshadowed both Go and JavaScript. On average, Rust proved to be 24 times faster than JavaScript and almost three times faster than Go, delivering type-checking speeds that are crucial for developers working with extensive codebases.
The journey of this Rust compiler is as intriguing as its performance. While Microsoft’s Go compiler took nearly two years to develop, the Rust version emerged in just three weeks, marking a swift entry into the tech arena. This accelerated development was made possible by AI agents and a robust test suite of over 13,000 programs, which ensured the compiler delivered precise error reports analogous to Microsoft’s compiler. Engineers utilized AI-driven tooling to meticulously port functions from Microsoft’s Go implementation to Rust, function by function, crafting a reliable and fast compiler.
But why choose Rust for this task? The answer lies in its design and intended use case. Cloudflare, aiming to integrate developer tools within sandboxes and browsers, needed a robust compilation environment. Rust, unlike Go, doesn’t require a garbage collector, making it an ideal candidate for web assembly packaging — a crucial feature for Cloudflare’s vision. Interestingly, the Rust compiler’s performance benefits might not solely arise from Rust’s language design; some optimization techniques used in the Rust port are already influencing future versions of Microsoft’s Go release.
As for what’s next, the Rust port, currently developed within the OXC toolchain from the creators of Vite, is set to advance further. Though not yet integrated into existing tools, its potential for use in type-aware lint rules is a promising development avenue. For those keen to experience the speed and efficiency of this Rust port firsthand, the project is available for exploration, promising a glimpse into what could be the future of TypeScript compilation.
The advent of this Rust compiler underscores the ever-evolving landscape of programming tools and the growing role of collaboration between traditional engineering and AI capabilities. As we continue to push the bounds of what’s possible with languages like Rust, we stand on the precipice of a new era in software development — one where speed and efficiency go hand in hand with innovation.
For further exploration on this topic, check out the relevant links and learn more about the projects and teams pioneering these advancements:
- Learn more about the TypeScript Rust port: Cloudflare Blog
- Explore the GitHub repository: OXC Project
- Additional resources and tutorials from Better Stack: Better Stack Community
- See the exciting projects Better Stack is working on: BetterStackHQ GitHub


