Skip to content
Tech News

tsrs Rust compiler from Cloudflare cuts memory by 70% and speeds up builds

Cloudflare and partners released tsrs, an experimental Rust-based TypeScript compiler that benchmarks show is significantly faster and more memory-efficient.

Illustration: A sleek silver laptop sits on a clean white desk, its screen displaying a vibrant abstract progress bar that has nearly reached the end.
AI-generated illustration: TechSec Headlines

Key points

  • Cloudflare, VoidZero, and Owner.com developed tsrs as a Rust port of the TypeScript compiler.
  • Benchmarks indicate tsrs is up to eight times faster and uses 70 percent less memory than TypeScript 7.0.
  • The project is incubated within the Oxc JavaScript compiler toolchain and is not a fork of TypeScript.

The short version

  • Cloudflare announced tsrs, a new Rust-based port of the TypeScript compiler, developed with VoidZero and Owner.com.
  • Early testing shows the tool is up to eight times faster and consumes 70 percent less memory than TypeScript 7.0.
  • The project aims to enable browser-based development environments by leveraging Rust’s efficiency in WebAssembly contexts.

The details

Cloudflare, VoidZero, and Max Schwenk of Owner.com are collaborating on tsrs, a Rust port of the TypeScript compiler, according to a blog post by Cloudflare. The team is working closely with the official TypeScript team and has incubated tsrs as part of the Oxc JavaScript compiler toolchain. This collaboration ensures the port remains aligned with the language’s direction. Cloudflare stated that the TypeScript team retains full control over the language design, and tsrs is not a fork. The goal is to reduce wait times for code checking, allowing developers to focus on building rather than waiting for compilation.

Early benchmarks published by Cloudflare show tsrs is up to eight times faster than TypeScript 7.0 when using the same number of type check workers. The port also uses approximately 70 percent less memory compared to that version. Cloudflare noted that TypeScript 7.1 beta is already up to 2.5 times faster than 7.0, with some optimizations upstreamed from tsrs. The company worked with the TypeScript team to ensure these benchmarks compare the same configuration, avoiding discrepancies from larger machine types or different options.

The context

Cloudflare emphasized that tsrs must preserve the TypeScript language strictly based on its original implementation to avoid incompatibility. The TypeScript team often spends years exploring options before selecting an implementation, and the Rust port must follow those decisions closely. While previous attempts to port TypeScript to other languages have largely failed, the TypeScript team’s earlier port from JavaScript to Go succeeded. Cloudflare noted that frontier AI models can now perform large-scale ports quickly, leading to various experimental versions in Rust or C++.

Rust offers unique advantages for WebAssembly (Wasm) environments, which is a key reason for this port. Unlike Go, which requires compiling a garbage collector into Wasm, Rust’s memory management allows straightforward interactions between Wasm guests and hosts. This memory efficiency is critical for running complete development environments in browsers or on Cloudflare Workers. Cloudflare recently announced support for native Rust in Workers, enabling efficient execution of build and deployment systems with small memory footprints.

What to watch

  • The stability of the experimental tsrs package available on npm.
  • Future upstreaming of tsrs optimizations into the official TypeScript compiler.
  • Adoption of tsrs in browser-based development environments.
  • Performance comparisons as TypeScript 7.1 and later versions release.

What it means for organisations

Organisations should assess whether experimental compiler tools align with their stability requirements. Teams usually evaluate new build tools in isolated environments before integrating them into production pipelines. Engineering leaders need to determine if the performance gains justify the risk of using an experimental package. Suppliers should monitor compatibility with existing TypeScript configurations. Internal teams must decide who manages the transition if they adopt the tool. Communication channels should be established to report any inconsistencies in type checking.

What to do and how to stay safe: Cloudflare

  • Review current build times and memory usage to determine if the performance gains are relevant to your workload.
  • Test the experimental tsrs package in a non-production environment to check for compatibility with your codebase.
  • Monitor official TypeScript releases for any upstreamed optimizations that might improve performance without switching tools.
  • Evaluate whether browser-based development environments are a priority for your team before adopting Wasm-focused tools.

Step-by-step guide: Secure Home Routers for Small Business Networks

General security guidance from the TechSec Headlines newsroom. It is not confirmed advice from the organisations named in this story.

Frequently asked questions

Is tsrs a fork of TypeScript?

No, Cloudflare states that tsrs is not a fork and the TypeScript team retains full control over the language design.

How much faster is tsrs compared to TypeScript 7.0?

Early benchmarks show tsrs is up to eight times faster and uses 70 percent less memory than TypeScript 7.0.

Can I install tsrs now?

Yes, you can try an experimental release by installing the tsrs package from npm.

Sources

  1. Cloudflare
CloudflareTypeScripttsrsRustOxc

Related stories

Cloudflare blocks eMudhra keys after weak cryptographic compromise

Cloudflare is forcing updates and blocking trust for eight intermediate certificates from eMudhra that use keys attackers can mathematically break to forge identities.

Independent cybersecurity reportingGet Alerts