Skip to content
Sıfırıncı Dakika
Latest

Cloudflare and VoidZero announce tsrs, a Rust port of TypeScript

Software2 min read
Cloudflare Blog

In brief

Cloudflare and VoidZero are working with Max Schwenk of Owner.com on tsrs, a Rust port of the TypeScript compiler. Incubated within the Oxc toolchain, the port is up to 8x faster and uses about 70% less memory than TypeScript 7.0 in early benchmarks. tsrs is available as an experimental package on npm.

  • Rust port of the TypeScript compiler
  • Up to 8x faster than TypeScript 7.0
  • About 70% less memory usage
  • Incubated in the Oxc toolchain
  • Memory-efficient model for WebAssembly
  • Experimental release on npm

A Rust port of TypeScript

Cloudflare and VoidZero announced tsrs, a project that ports the TypeScript compiler to Rust. The work is being done with Max Schwenk of Owner.com, in close collaboration with the TypeScript team, and is incubated as part of the Oxc JavaScript compiler toolchain.

The teams stress that they are not forking TypeScript. They say the TypeScript team should remain in full control of the language's design and direction, and that a Rust port has to follow those decisions closely or it will eventually become incompatible.

Early performance results

With the same number of type-check workers, early benchmarks show tsrs is up to 8x faster and uses roughly 70% less memory than TypeScript 7.0. TypeScript 7.1 beta is itself up to 2.5x faster than 7.0, and some of those optimizations were upstreamed from tsrs.

The teams say the comparisons use the same configuration and were validated with the TypeScript team. By default, tsrs ships with an adaptive configuration based on machine type that uses more memory but runs even faster.

Why Rust?

TypeScript's Go port already delivered major speed gains. Rust's standout advantage is WebAssembly: compiling a Go program to Wasm also brings Go's garbage collector along, while Rust's memory model enables more efficient memory interaction between a Wasm guest and host. That makes it easier to run full development environments in browsers and on Cloudflare Workers.

How to try it

The experimental release can be installed from npm:

  • npm install tsrs
  • npx tsrs

The teams note that frontier AI models can now do large-scale ports in a matter of days, and that several Rust and C++ versions of TypeScript have appeared. tsrs aims to stay faithful to TypeScript's original implementation.

Why it matters

A development that could significantly cut compile and type-check times for TypeScript teams; trying the experimental release and giving feedback can help the project.

Sources

  1. Cloudflare BlogFirst reported byPrimary source
    Introducing tsrs: a Port of TypeScript to Rust

Related stories