The TypeScript slowdown hiding in plain sight
TypeScript development involves two distinct processes: transpilation and semantic type-checking. Fast build tools like esbuild or Vite rapidly strip TypeScript syntax, converting it into runnable JavaScript. This step is quick, often taking milliseconds.
The bottleneck emerges during semantic type-checking, which verifies code validity. This process, crucial for editor feedback and CI pipelines, can span minutes on large projects. Developers experience this delay as sluggish error reporting in IDEs or extended CI runtimes.
Microsoft officially addressed this with a Go port of the TypeScript compiler, delivering an 8-12x speedup over the legacy JavaScript engine. This Go version, part of TypeScript 7.0, significantly reduced check times, for instance, dropping VS Code’s type check from 125.7 seconds to 10.6 seconds.
Recently, a community-led Rust implementation emerged, offering a new contender. Developed rapidly by Cloudflare and the Oxc project using AI agents, this Rust port of the Go codebase claims to be nearly three times faster than the official Go version. While not yet integrated across the ecosystem, it passes over 99.9% of TypeScript conformance tests, demonstrating its potential.
The benchmark: 0.3 seconds versus 0.7
To quantify the speedup, a benchmark pitted the legacy JavaScript compiler against the new Go and Rust ports. The test used the official TypeScript repository, a substantial codebase comprising 793 files and approximately 380,000 lines of code. Four scenarios evaluated performance: perfectly valid code, a single type error, a cascading failure from a broken core type, and deep recursion.
Across these diverse scenarios, the results were striking. The JavaScript compiler consistently took the longest, ranging from 6.6 to 13 seconds. The Go port significantly improved on this, completing checks in 0.6 to 2.2 seconds. However, the Rust version demonstrated superior performance, finishing in a mere 0.2 to 0.5 seconds.
Putting the headline numbers in perspective, the Rust compiler averaged roughly 24 times faster than the original JavaScript implementation. More impressively, it was nearly three times faster than the Go port in this specific test. These results highlight the potential for substantial developer experience improvements.
It is crucial to remember that benchmark results can vary. Factors such as hardware specifications, project structure, specific compiler versions, and the exact benchmarking methodology can all influence performance. Nevertheless, the consistent and dramatic speedup observed with the Rust port is a significant development for the TypeScript ecosystem.
AI agents copied the hard-won design
Remarkably, the Rust port did not originate from a human engineer designing a new type system. Instead, one engineer directed AI agents, primarily Claude Opus 3.5, to translate Microsoft's existing Go compiler function by function into Rust. This approach relied on a mechanical, rather than creative, translation.
This translation strategy leveraged TypeScript’s extensive conformance suite, comprising over 13,000 test cases. Each test case specifies the exact diagnostic errors a compliant compiler should report. Agents would port a function, run the corresponding tests, debug any discrepancies, and then proceed to the next function.
Passing all these tests, as the Rust version now does, confirms its compatibility and ability to produce identical type-checking results to the official Go compiler. This allowed for rapid, verifiable iteration over just three weeks of development. For more on the official Go port, see A 10x Faster TypeScript - Microsoft Developer Blogs.
However, passing conformance tests primarily verifies output correctness. It does not inherently guarantee equivalent performance across all project types, seamless editor integration, or immediate production readiness for every codebase. While the benchmarks presented in the video are compelling, further integration and real-world testing will be crucial to solidify its broader adoption.
Enjoying this? Get one like it in your inbox each morning.
one email a day · unsubscribe in two clicks · no third-party tracking
Speed is exciting; adoption is the real test
Rust’s performance gains are exciting, but its WebAssembly story offers a compelling reason for adoption. Cloudflare, for instance, aims to run developer tools directly within browser and edge environments. Rust compiles to WebAssembly without bundling a garbage collector, unlike Go, making it ideal for lightweight, sandboxed execution.
Microsoft’s Go implementation of the TypeScript compiler remains the official reference, powering TypeScript 7.0 with significant speedups. The Rust port, however, is being developed within the Oxc project, a Rust toolchain from the creators of Vite. This positions it for future applications like type-aware linting in Oxc Lint, leveraging its speed for real-time feedback.
Consider the benchmark a promising signal, not a universal guarantee. Verify compatibility and tooling support for your specific project stack before integrating. Watch whether these optimizations and integrations reach everyday workflows, driving down cycle times for developers in practice. The true test for the Rust port will be its journey from impressive benchmark to widespread, practical utility.
Frequently Asked Questions
Is the Rust TypeScript compiler an official Microsoft release?
No. It is a community-led Rust port associated with the Oxc project; Microsoft's official native compiler port is written in Go.
How much faster was the Rust compiler in the video benchmark?
On the TypeScript repository test, it averaged about 24 times faster than the JavaScript compiler and nearly three times faster than the Go port.
Why build a TypeScript compiler in Rust?
Rust's lack of a garbage collector can make WebAssembly packaging attractive, while the port also explores performance and memory optimizations.
Was the Rust port written by AI?
AI agents performed much of the mechanical porting under an engineer's direction, using Microsoft's compiler and TypeScript's conformance tests as guides.

