Skip to content
OddBrief
Tech2 minPrimary source linked

Cloudflare's tsrs ports TypeScript to Rust, and the pitch is WebAssembly, not speed

The Rust port claims up to 8x the speed of TypeScript 7.0, but Cloudflare says the real reason is running type checks in Wasm without Go's garbage collector.

AI-assisted, human-reviewed

Illustration of a glowing cube inside a glass sphere connected to a small circuit boardTech
AI-generated illustration

Key facts

Who
Cloudflare and VoidZero, with Max Schwenk of Owner.com, incubated in the Oxc toolchain
Claim
up to 8x faster and about 70% less memory than TypeScript 7.0 at equal worker counts
Why Rust
Wasm builds without a bundled garbage collector, unlike Go
Status
experimental npm release; diagnostic order differs and LSP support is not in yet

Cloudflare has released tsrs, an experimental Rust port of the TypeScript compiler built with VoidZero and Max Schwenk of Owner.com, and says it runs up to 8x faster than TypeScript 7.0 with about 70% less memory. The company's main argument for it, though, is not speed but WebAssembly: Rust can run in Wasm without carrying a garbage collector along, which Go cannot.

The port is being incubated in the Oxc compiler toolchain and is available on npm as tsrs.

Why a second port after the Go one

Microsoft's TypeScript team already rewrote the compiler in Go, a move Cloudflare credits with making TypeScript about 10x faster. Cloudflare also notes that this was the only one of many attempts to port TypeScript that ever succeeded.

What changed, according to the post, is that frontier AI models can now carry out large ports "almost independently in a matter of days." Cloudflare says it has seen a wave of such efforts in Rust and C++, ranging from faithful ports to complete redesigns.

Its reason for wanting Rust is the browser and the sandbox. Compiling Go to Wasm means shipping Go's garbage collector inside the module, while Rust's memory model lets a Wasm guest and its host share memory directly. A small footprint matters when whole build systems run in tight loops on Workers, and Cloudflare says it also makes it possible to run a full toolchain in a browser tab, on an embedded device or inside an agent's sandbox.

The benchmark comes with a caveat

The 8x figure compares tsrs with TypeScript 7.0 with each running an equal count of type-check workers, a setup Cloudflare says it agreed on with the TypeScript team. It openly says that other ports have published bigger numbers by using larger machines and non-default options.

The comparison is also against a moving target. TypeScript 7.1 beta is up to 2.5x faster than 7.0, and Cloudflare says some of those optimizations came from tsrs and were contributed back to the Go codebase. By default tsrs uses an adaptive setting that trades extra memory for more speed.

Not a fork, maintained by agents

Cloudflare stresses that tsrs is not a fork and that the TypeScript team keeps full control of the language. To stay in step, it plans to reuse the routine it runs for Vinext: an agent checks upstream changes every morning and files issues, and every night the TypeScript test suite runs against tsrs to rebuild a compatibility matrix.

The port is not yet identical to upstream. Diagnostics can print in a different order, and language server support is missing for now; Cloudflare is working with Theo Browne to merge tsrs with his tsc-rs project to add it. No date has been given for a stable release.

Sources

  1. Introducing tsrs: a Port of TypeScript to Rust
    Cloudflareprimary source