Cloudflare Backs tsrs, an Agent-Written Rust Port of TypeScript Up to 8x Faster Than 7.0
TL;DR
tsrs is a Rust port of the TypeScript 7 type checker. Max Schwenk, Head of AI Developer Experience at Owner.com, says he wrote none of it: Claude Opus 5.5 and its subagents did. On Owner's 37,000-file backend, a single-threaded TypeScript 7.0 check took 80 seconds and 19 GiB of memory. tsrs does it in about 7 seconds in CI. On October 20, Cloudflare and VoidZero moved it into the Oxc toolchain, claiming up to 8x the speed of TypeScript 7.0 with about 70% less memory. That afternoon Microsoft shipped the TypeScript 7.1 beta, and a TypeScript team member said some of its speedups were found in tsrs first.
Why Owner wanted a new compiler
Owner's backend monolith, Olympus, is about 37,000 TypeScript files typechecked as one program. Schwenk's write-up puts the TypeScript 7.0 cost at 19 GiB of memory and 80 seconds of wall time for a single-threaded check. That is already the Go port, the one that made TypeScript roughly 10x faster than the old JavaScript compiler.
Speed was a nuisance. Memory was the actual blocker. "Even on a $3,000 MacBook with 36 GiB of memory, engineers couldn't run several agents in parallel without risking their machine locking up," he writes. If every coding agent runs its own typecheck in its own worktree, compiler memory decides how many agents fit on a laptop.
How an agent wrote it
On September 30, after an agent kept hitting walls while digging into memory usage, Schwenk wondered whether Opus 5.5 "could one-shot a port of the TypeScript compiler to Rust." Around 1:30 AM he told it to work overnight until something ran. "I woke up to a working typechecker and assumed it was lying."
It wasn't lying, and the next few weeks went to proving that. After some back and forth, the agent was running "20-plus subagents in parallel." Schwenk's job was direction. He handed the agents a profiler, the TypeScript performance wiki, Typeslayer and "a lot of tokens." He also set the scope (type checker first, emit and language server later) and the rules: tests are the spec, and each Go package becomes one Rust crate.
"I wrote zero code. Not 'barely any'. Zero." (Max Schwenk, Owner.com)
The repo's porting guide reads like a contract written for a tireless, overconfident contractor. The port is "mechanical and faithful": same algorithms, same function order, same diagnostics. There is one Rust file per Go file, so relater.go becomes relater.rs. "Behavior that matches the Go code is correct; 'improvements' are bugs." For performance work, the repo's AGENTS.md sets a numeric bar: a change lands only if it cuts single-threaded instructions by at least 1%.
The memory trick
Rust has no garbage collector, and the checker's AST nodes, symbols and types point at each other in cycles, which makes a line-by-line port from Go awkward. tsrs puts those objects in arenas and refers to them through a P<T> handle. The handle compares by identity like a Go pointer, and it is a 32-bit offset into one reserved address range instead of a full 64-bit pointer. Batch runs mostly never free the arenas until the process exits.
Think of a hotel that never checks anyone out until the building closes. You never pay for housekeeping (no GC pauses, no reference counting), and every room number is short enough to fit on a sticky note. The language server, which has to live for hours, gets owned regions so it can release old programs.
Schwenk's post lists the rest of the memory diet with measured deltas. No longer copying source text cut memory 21%. Lazy member resolution took another 23%. Smaller objects took 21%. Pointer compression shaved 14 to 15% off peak memory for a 6.5% instruction cost, and work stealing cut wall time 13.8% at 4 checkers.
The numbers on Owner's monolith
Owner's internal benchmark runs Olympus through three compilers at the same checker counts. tsrs also beats the September 29 nightly of 7.1.
In day-to-day use, the Olympus check now takes "seven seconds in CI and about twelve on a MacBook." Owner projects "hundreds of thousands of dollars a year" in sandbox and CI savings. That figure comes with no breakdown, so file it as Owner's estimate.
The type-aware linter got the same treatment. tsrslint, a port of tsgolint on top of tsrs, linted eight open-source projects in 37.3 seconds against tsgolint's 169.4, with 11.5 GiB of memory against 45.0.
How it was checked
"A faster compiler that finds fewer errors is a broken compiler with good marketing," Schwenk writes, and that is the right worry. Verification ran in stages against the conformance suite TypeScript's own Go port uses.
- On the first end-to-end run, 78% of TypeScript's error baselines matched byte for byte. Another 21% differed only because tsrs had no type printer yet.
- With the type printer added, the match rate hit 99.97%, "all but four of 13,462," and every type and symbol baseline matched.
- Owner then ran Olympus's CI typecheck on both the Go and Rust compilers and tracked disagreements: "Tens of thousands of runs over a week, zero disagreements."
Schwenk doesn't oversell it: "None of it is a proof." The repo's compatibility notes list known gaps. Diagnostic and trace order can differ from the pinned Go compiler, and --init and --showConfig are not supported.
Cloudflare takes the wheel, carefully
Cloudflare's October 20 post says it and VoidZero are now working on tsrs with Schwenk inside the Oxc project, "in close collaboration with the TypeScript team." The headline claim: up to 8x faster than TypeScript 7.0 with the same number of type check workers, and about 70% less memory.
The post also spends a paragraph saying what Cloudflare is not doing. "To be clear, we are not forking TypeScript." Microsoft keeps control of the language, and a Rust port "has to follow those decisions closely, or it will eventually fall apart and become incompatible." Two plans back that up:
- Theo Browne's tsc-rs, a rival Rust port of TypeScript 7 that its README says LLMs wrote for "over $420,000" in tokens, gets merged into tsrs so one package covers every feature, including the language server.
- Cloudflare will reuse the process it runs for Vinext against Next.js. Agents review upstream TypeScript changes every morning and a compatibility matrix runs nightly. Somewhere a bot now reads Microsoft's commit log with its coffee.
Cloudflare's interest is mostly about where a compiler can run. tsrs already publishes a WASI build, @tsrs/wasm. Cloudflare names type-aware lint rules in Oxlint, full dev toolchains inside sandboxed Cloudflare environments, and type checking in browsers and on embedded devices as targets. You can already try it in the browser playground.
Microsoft's response: faster Go
Microsoft's TypeScript 7.1 beta landed the same day, and its benchmarks show the Go compiler getting much faster. With the default four checker threads, mui-docs dropped from 22.2 seconds on 7.0 to 11.9 on the beta, and its memory fell from 8,093 MiB to 4,079.
On Hacker News, TypeScript team member Daniel Rosenwasser said the team had studied which tsrs optimizations are safe, built "our own Rust vibe port," and suspects "a lot of the speed does not just come down to language choice." He added that some of what makes 7.1 faster and leaner "actually comes from optimizations discovered in tsrs."
That shifts how you should read the benchmarks. The public results in the repo compare tsrs, which ports a 7.1 development commit, against the shipping [email protected], so part of each gap is optimizations that Go is about to get too. The Owner table above includes a 7.1 nightly and still shows a 7x lead at eight checkers.
Should you switch?
Not in production yet. Cloudflare calls the npm release experimental, and the aim is a stable release against TypeScript 7.1. The repo is Apache-2.0 with about 1,100 GitHub stars. Issues are open, but pull requests are closed because the maintainers lack review bandwidth. To try it on your own repo:
pnpm add -D tsrs
pnpm exec tsrs --noEmit
Run it next to your existing tsgo check and diff the output, which is how Owner earned its own confidence. Monorepos where typecheck memory caps how many agents or CI jobs share a box will see the biggest change. If your check already finishes in two seconds, you have nothing to fix here.
For agent builders, the reusable part is the method. A huge port came out of one model running parallel subagents, with an existing conformance suite as the spec, "improvements are bugs" as the house rule, and a measured instruction-count bar for every optimization. The human chose scope and checked results. The upstream project then borrowed the optimizations.
Key Takeaways
- tsrs is a Rust port of the TypeScript 7 type checker that Owner.com's Max Schwenk says Claude Opus 5.5 and its subagents wrote with zero human code.
- On Owner's 37,000-file monolith it beat TypeScript 7.0.2 by 9.8x at 8 checkers with 6.6x less memory, and typecheck now takes about 7 seconds in CI, down from 80.
- Verification relied on TypeScript's conformance suite (99.97% of error baselines matched, all but four of 13,462) and a week of side-by-side CI runs with zero disagreements.
- Cloudflare and VoidZero now develop it inside Oxc, say they will not fork the language, and plan to merge Theo Browne's tsc-rs and track upstream with daily agent reviews.
- Microsoft's TypeScript 7.1 beta, out the same day, includes optimizations its team says were first discovered in tsrs, so expect the gap against Go to narrow.
Sources: Owner Engineering: tsrs, Cloudflare Blog: Tsrs, a port of TypeScript to Rust, oxc-project/tsrs on GitHub, tsrs benchmark results, tsrs porting guide, Microsoft: Announcing TypeScript 7.1 Beta, Daniel Rosenwasser on Hacker News, pingdotgg/ts-rust on GitHub, The New Stack