~4m5:19
Better Stack

TypeScript Got Ported To Rust... And It's 3x Faster Than Go

Nov 5, 2026

Read: ~4m · You save: 1 min

TypeScript rewritten in Rust... and it's 3 times faster than Go

The Rust version of the TypeScript compiler is almost 3 times faster than Go. We test the claims on a real 380,000-line repository and explore how it was built with AI.

In July, Microsoft ported the TypeScript compiler to Go, but many developers had expected a Rust version. Now a fully compatible TypeScript compiler written in Rust is available. According to test results, it is nearly three times faster than the Go version. Below, the reasons for creating the port, the performance comparison methodology, and the results are described.

Two Main Stages of Working with TypeScript

Two processes are performed when working with TypeScript:

  • Building. The code is converted to JavaScript so that it can run in any environment. This stage is fast: tools such as esbuild or Vite simply strip out the types and pass the code along.
  • Type checking. This stage is slow. In a large codebase, checking can take several minutes. New compilers written in Go and Rust were created specifically to speed up this process.

Even a small change in a large project can lead to a long wait before type errors appear or disappear in the code editor.

A Go-based compiler was tested earlier. It turned out to be about 10 times faster than the previous JavaScript-based compiler. According to its authors, the Rust version is faster still than this result.

Testing Methodology

The test project was a TypeScript repository downloaded from GitHub. It contains 793 files and about 380,000 lines of code. The script compared the performance of three compilers: the previous compiler written in JavaScript, a compiler written in Go, and a compiler written in Rust.

The check was performed in four scenarios:

  1. All types are correct.
  2. One simple type contains an error.
  3. A base type is corrupted, which causes a large number of cascading errors.
  4. A recursive type has excessive depth.

Results

ScenarioJavaScriptGoRust
1. No errorsabout 7 s0.7 s0.3 s
2. One type error6.6 s0.6 s0.2 s
3. Corrupted base type13 s2.2 sabout 0.5 s
4. Overly deep recursive typeabout 7 s0.8 s0.4 s

On average, the Go compiler runs 9–10 times faster than the JavaScript compiler. The Rust compiler is about 24 times faster than the JavaScript compiler and almost three times faster than the Go version. The authors note that Rust's high speed is expected, since this language is very fast. Nevertheless, the result remains significant.

In the third scenario, where a corrupted base type causes many errors, Go and Rust reported the same 26,054 errors. This confirms that the compilers' results coincide.

Сроки разработки и роль ИИ-агентов

The Go compiler was developed by Microsoft for almost two years. It was announced in March 2025. The Rust version was created in three weeks, from the first commit to the announcement.

The port was started by one engineer who did not write code himself. He led a team of AI agents headed by Claude Opus 5.5. The agents ported Microsoft's compiler to Rust one function at a time.

This approach became possible thanks to the large TypeScript test suite. It includes more than 13,000 small programs, and for each one, the exact errors that the compiler must produce are recorded. The process looked as follows:

  1. The agent ports a function.
  2. The agent runs the tests.
  3. The agent fixes the errors that occur.
  4. The agent moves on to the next function.

The Rust version passes all the tests and produces the same errors as Microsoft's compiler.

The AI agents did not design new solutions. The Microsoft team solved the complex problems over the previous two years. The Rust port replicates the architecture of the original, function by function.

Development is led by Cloudflare and the Vite team, together with the TypeScript team.

Why the compiler is written in Rust

The main reason is related to where it runs. Cloudflare wants to run development tools in its own isolated environments and directly in the browser. To do this, the compiler is packaged into WebAssembly, which runs in virtually any environment.

The Go compiler uses a garbage collector to automatically free memory. When building for WebAssembly, this garbage collector has to be included in the final package. Rust does not use a garbage collector, so no additional components are required.

The TypeScript team assumes that a significant part of the speedup is related not so much to the Rust language as to the technical solutions found during the porting process. Some of them are already being included in the next release of Microsoft's Go compiler.

Current State and Plans

The Rust port is not yet integrated into other tools. Its development is taking place in Oxc, a toolkit written in Rust that is created by the same team behind Vite. The developers plan to use the compiler for type-aware linting rules in oxlint.

Introduction

The Rust version of the TypeScript compiler is fully compatible and almost three times faster than the Go version. The author intends to verify the claimed figures in practice.

  • In July, Microsoft ported the TypeScript compiler to Go, but many expected a Rust version
  • The new TypeScript compiler in Rust is fully compatible and almost 3 times faster than the Go version
  • Press statements claim a speedup of 2–8 times, and the author plans to verify this by comparing both versions

Why the compiler is needed and what gets accelerated

The compiler performs two main tasks: building (transforming into JavaScript) and type checking. Building is fast, while type checking on large projects can take minutes, and it is precisely this that compilers written in Go and Rust speed up.

  • The build step converts code to JavaScript; tools like esbuild or Vite simply strip types, which is why they work quickly
  • Type checking on a large codebase can take minutes, and it is precisely this that compilers written in Go and Rust speed up
  • The Go version was previously found to be roughly 10 times faster than the old JavaScript compiler

Performance Comparison

The test bench is a TypeScript repository: 793 files and about 380,000 lines of code. Four scenarios were compared, and the Rust version showed the greatest speedup.

  • TypeScript test repository from GitHub: 793 files, about 380,000 lines of code
  • Scenario 1 (all types correct): JavaScript ~7 s, Go 0.7 s, Rust 0.3 s
  • Scenario 2 (one type error): JavaScript 6.6 s, Go 0.6 s, Rust 0.2 s
  • Scenario 3 (broken base type, cascading errors): JavaScript 13 s, Go 2.2 s, Rust ~0.5 s
  • Scenario 4 (overly deep recursive type): JavaScript ~7 s, Go 0.8 s, Rust 0.4 s
  • On average Go is about 9–10 times faster than JavaScript, Rust is about 24 times faster than JavaScript and almost 3 times faster than Go

How the Rust Port Was Created

The Go compiler from Microsoft was developed for almost 2 years (announced in March 2025), while the Rust version was created in 3 weeks from the first commit to the announcement with the help of AI agents.

  • Microsoft's Go compiler was developed for almost 2 years and announced in March 2025
  • The Rust version was created in 3 weeks from the first commit to the announcement
  • One engineer started the work but did not write the code himself; a team of AI agents led by the Claude Opus 5.5 model ported the Microsoft compiler from Go to Rust function by function
  • The TypeScript test suite includes more than 13,000 small programs, each with an exact list of expected errors; the agent ports a function, runs the tests, fixes errors, and moves on
  • The Rust version passes all tests and produces the same errors as Microsoft's compiler; in a benchmark where a basic Go type was broken, Go and Rust reported the same 26,054 errors

Why Write the Compiler in Rust

Cloudflare wants to run development tools in its sandboxes and in the browser, so the compiler is packaged as WebAssembly. The absence of a garbage collector in Rust simplifies such packaging.

  • The port is being developed by Cloudflare and the Vite team jointly with the TypeScript team
  • Cloudflare wants to run development tools in its sandboxes and directly in the browser
  • The compiler is packaged as WebAssembly, which runs on practically everywhere
  • Go uses a garbage collector that must be included in the build; Rust does not use a garbage collector
  • The TypeScript team believes that a significant part of the speedup is related not so much to Rust as to techniques discovered in the Rust port, which are already moving into the next Go release from Microsoft

Current State and Plans

The Rust port is not yet integrated into other tools, but it is being developed inside OXC (the Rust toolchain of the Vite team) and is planned for type-dependent rules of the oxlint linter.

  • The Rust port is not yet integrated into any other tools
  • Development is taking place inside OXC, a Rust toolchain from the same team that builds Vite
  • The compiler is planned to be used for type-dependent rules of the oxlint linter