Skip to content
INTERNET INFRASTRUCTURE & NETWORKS

Cloudflare and VoidZero Join Forces to Build tsrs, a High-Performance Rust Port of the TypeScript Compiler

In an ambitious move to accelerate the JavaScript and TypeScript ecosystems, Cloudflare and VoidZero have announced a collaborative initiative alongside Max Schwenk of Owner.com to develop tsrs, a faithful Rust port of the TypeScript compiler. Being incubated as part of the Oxc JavaScript compiler toolchain, the project is being developed in close partnership with the official TypeScript team. The overarching objective is to drastically reduce the time developers spend waiting for code to be checked, thereby maximizing active building time while bringing complete, sandboxed development environments to a broader array of environments, including direct browser-based execution.

Crucially, the project maintainers have emphasized that they are not forking TypeScript. They maintain a firm belief that the official TypeScript team should retain absolute control over the language’s design, features, and long-term strategic direction. Over the years, the TypeScript maintainers have successfully guided the language’s massive adoption across the global JavaScript community through careful, deliberate vision. The creators of tsrs intend to preserve this dynamic. While the TypeScript team moves quickly on many fronts, certain complex features require years of intentional exploration and prototyping before a final implementation is chosen. A high-performance port must mirror these decisions meticulously to avoid breaking compatibility and fracturing the ecosystem. Consequently, the language specification will remain strictly tethered to the original implementation, with the TypeScript team holding sole responsibility for its evolution.

Performance and Memory Improvements

Early benchmarks of the new Rust-based compiler paint a remarkably promising picture. When utilizing an equivalent number of type-checking workers, tsrs has demonstrated speeds up to 8 times faster while simultaneously consuming approximately 70% less memory than TypeScript 7.0. These efficiency gains highlight the profound advantages of a systems-level language rewrite for heavy computational tasks like type checking.

These performance wins are already bleeding back into the mainstream ecosystem. The upcoming TypeScript 7.1 beta introduces substantial performance enhancements of its own, making it up to 2.5 times faster than TypeScript 7.0, with several core optimizations having been directly upstreamed from the tsrs project. The development teams have been careful to ensure that benchmarks provide an apples-to-apples comparison. While various third-party ports of TypeScript have emerged with aggressive performance claims—often achieved by running on oversized machine types or applying non-standard compiler configurations—the tsrs team collaborated directly with the official TypeScript team to guarantee that all comparative benchmarks evaluate identical configurations.

Out of the box, tsrs ships with an adaptive configuration tailored to the host machine type. While this adaptive mode leverages additional memory resources, it pushes execution speed even further. Developers looking to experiment with the experimental release can readily install the tsrs package from the npm registry and execute it directly via command-line tooling to evaluate the performance gains within their own codebases.

Why Now?

The landscape of compiler engineering has evolved dramatically. Over the years, numerous attempts have been made to port TypeScript to alternative languages to escape the performance constraints of the original JavaScript implementation. Historically, due to the immense complexity of the TypeScript type system, only one such port truly succeeded: the official TypeScript team’s own port of the compiler from JavaScript to Go.

However, the advent of frontier artificial intelligence models has fundamentally changed the economics of software development. AI systems can now assist with large-scale code ports independently over the span of just a few days. This technological leap has catalyzed a wave of new experiments, ranging from experimental "slopforks" to faithful ports and entirely re-architected versions of TypeScript written in systems languages like Rust and C++. This flurry of activity underscores a persistent, industry-wide demand for even faster compilation and type-checking pipelines.

Why Rust?

Introducing tsrs: a Port of TypeScript to Rust

A natural question arises: given that the official Go port already made TypeScript roughly ten times faster and significantly more memory-efficient than its original JavaScript incarnation, why pursue a Rust implementation at all?

The answer extends beyond raw execution speed. Rust introduces unique architectural advantages, most notably in its capability to run efficiently within WebAssembly (Wasm) environments. The Rust-and-Wasm ecosystem has matured significantly, largely due to fundamental differences in memory management. When a Go program is compiled to WebAssembly, the runtime must bundle Go’s internal garbage collector alongside the application code. Rust, by contrast, relies on a deterministic ownership and borrowing model that requires no runtime garbage collector. This enables seamless, highly efficient memory interactions between a WebAssembly guest environment and its host. This superior memory efficiency makes Rust an ideal fit for WebAssembly-driven use cases.

Cloudflare Workers have long provided native support for WebAssembly workloads, and recent architectural updates—such as support for native Rust in Workers via the new Emscripten target for wasm-bindgen—have amplified these benefits. When running continuous software build and deployment pipelines within tight execution loops on edge infrastructure, minimizing memory footprints translates directly into tangible performance and cost advantages. This efficiency makes it feasible to run fully encapsulated development environments in distributed contexts where resource constraints previously made such operations impossible.

When combined with autonomous AI agents, this capability unlocks entirely new paradigms. Developers can execute complete software toolchains end-to-end within fully sandboxed environments on Cloudflare’s edge network. Simultaneously, the low overhead of WebAssembly enables these same development environments to run securely client-side directly within a web browser, on resource-constrained embedded devices, or across distributed IoT applications.

How the tsrs Port Will Be Maintained

To ensure long-term stability and prevent community fragmentation, the tsrs project is consolidating its efforts. The team is actively working with Theo Browne to merge tsc-rs and tsrs into a single, unified package that comprehensively supports all standard TypeScript features, including the Language Server Protocol (LSP) and content mappers.

Furthermore, the maintainers are adapting a successful maintenance workflow previously established for vinext, an open-source project designed to keep Next.js running seamlessly on Vite. This approach heavily leverages automated agents to monitor upstream changes. Each morning, automated agents review modifications, fetch repository diffs, and generate tracking issues for any updates that could impact compatibility. Every night, a comprehensive compatibility matrix is automatically regenerated by running the upstream test suite against the port. When a discrepancy or regression is identified, agents assist developers in pinpointing the relevant changes across both codebases, constructing targeted reproductions, porting associated test cases, and proposing robust fixes.

This exact methodology is being applied to the TypeScript ecosystem with rigorous oversight to ensure the Rust port never diverges from upstream behavior. Whenever performance enhancements are discovered during the porting process, the team actively attempts to contribute those optimizations back to the upstream TypeScript Go codebase so that the entire community benefits. While minor discrepancies currently exist—such as subtle differences in the ordering of diagnostic error messages—the explicit goal is to drive these variations down to absolute zero ahead of a stable production release.

What’s Next?

Cloudflare has established itself as a prominent hub for free and open-source Rust tools that underpin the modern JavaScript ecosystem, including Vite, Rolldown, Oxlint, and Oxfmt. With more than ten million developers building applications on Cloudflare infrastructure, optimizing the foundational developer toolchain to be faster, more portable, and easier to execute across diverse environments remains a core priority. The engineering teams are already exploring deeper integrations of tsrs within their existing stack, such as powering type-aware lint rules inside Oxlint.

Much like the approach taken with vinext, the overarching mission is to foster a healthy, well-maintained open-source project that enhances the JavaScript landscape without disrupting the core language itself. The Oxc team has already initiated extensive codebase refactoring to maximize execution speed, minimize memory consumption, and ensure long-term maintainability. Acknowledging that the official TypeScript team is likewise actively experimenting with performance and memory enhancements for the compiler, the collaborators look forward to a cooperative future, working alongside the broader JavaScript community to forge the fastest and most reliable implementations of TypeScript possible.

Leave a Reply

Your email address will not be published. Required fields are marked *