Boring Go vs. Trendy Rust: Why TypeScript Rewrote Its Compiler in Go and How AI Agents Change Language ChoiceLongread · digest for November 27
Conceptual engineering still life on a graphite desk: two modular Go and Rust blocks in front of a terminal screen compiling TypeScript 7.0.
Longread7 sections≈ 22 min

Boring Go vs. Trendy Rust: Why TypeScript Rewrote Its Compiler in Go and How AI Agents Change Language Choice

An intriguing paradox just played out in software engineering. Microsoft has been investing in Rust for years and even elevated it to Tier 1 priority status. Meanwhile, TypeScript's lead architect Anders Hejlsberg literally created C#. When it came time to rewrite the slow TypeScript compiler from scratch, the choice seemed obvious: either native C# or ultra-fast Rust.

Instead, the Microsoft team picked Go, a language created by its direct rival Google. And they got up to a 12x speedup on code checking.

Language debates rarely produce anything useful, but real-world decisions like this show how engineering trade-offs actually work. Let's look past the hype: why did 'boring' Go beat trendy Rust on this specific job, where does the real line between them sit, why did the whole frontend toolchain move to native binaries, and what did an AI-agent experiment that rewrote Bun in Rust for $165,000 change?

Why the creator of C# picked Google's language for the new TypeScript

To understand the logic behind this move, look briefly at Anders Hejlsberg's career. His track record is all about speed and practicality for everyday developers, not academic elegance. In the early 1980s, he wrote a Pascal compiler in Z80 assembly. Borland bought the rights and released Turbo Pascal: the entire environment fit in roughly 39 kilobytes of memory and cost $50 while competitors charged hundreds. In the era of noisy floppy disks, it felt like magic and brought programming to the masses.

Over the next seven years at Borland, Hejlsberg turned Object Pascal into Delphi, the legendary rapid-development tool for Windows. In 1996, Microsoft poached him with a reported $3 million signing bonus, prompting an angry Borland to sue over aggressive hiring. At Microsoft, Hejlsberg first worked on Visual J++, then Sun Microsystems sued over Java incompatibility, and Anders ended up leading the design of C#. In 2012, his team released TypeScript, a layer over JavaScript where types are stripped at build time so existing browser code keeps working.

Now a person with that resume sits down to rewrite the TypeScript compiler in the microsoft/typescript-go repository (the new binary is called tsgo), and walks right past both C# and Rust. Why? It came down to three practical realities.

First is the cyclic type graph. Put simply, the compiler holds millions of objects in memory that point to each other in circles: type A points to type B, and type B points back to type A. Picture a giant spiderweb where threads loop into dozens of rings. In Go, the Garbage Collector (GC) handles that web effortlessly, sweeping memory for anything no longer needed. Rust has no garbage collector; it enforces strict memory ownership rules. Pushing a cyclic graph through Rust would mean wrapping code in Rc<RefCell<...>>, building a custom memory allocator, or redesigning all data structures from scratch.

Second is the shape of the existing codebase. The old TypeScript compiler is written using plain functions and structs, without heavy object-oriented class hierarchies. That code maps to Go almost line for line. The team could port the logic directly instead of changing both the language and the project architecture at once. A double overhaul at that scale almost always delays a release by years.

Third is a rare combination of three traits. As Hejlsberg explained in Microsoft's official announcement, Go turned out to be the lowest-level language that still offers native machine code compilation, garbage collection, and easy concurrency. A native binary removes the V8 engine overhead, while goroutines with shared memory let the compiler parse and check files in parallel across all CPU cores.

Official Microsoft TypeScript blog banner announcing the port of the compiler to native Go code (Source: Microsoft TypeScript DevBlog)

Work on the port quietly began in October 2024. The public announcement, 'A 10x Faster TypeScript', landed on March 11, 2025, followed by a preview on May 22. TypeScript 6.0—the final JavaScript-based compiler release—shipped in March 2026, and TypeScript 7.0 launched on July 8, 2026.

The biggest impact shows up in Microsoft's own benchmarks on the massive VS Code codebase: full project type-checking dropped by an order of magnitude.

Full type-check of the VS Code codebase in TypeScript

On smaller real-world projects, the numbers are more modest but still impressive. An independent run on a large monorepo showed cold checks speeding up by 5.4x, rebuilds after editing a single leaf module speeding up by 7.9x, and peak RAM usage dropping by about 16%. The promised '10x' is the ceiling on the heaviest codebases, yet getting five to eight times faster just by upgrading the compiler is still a huge win.

Of course, some developers grumbled. C# engineers asked why Microsoft didn't use C# with NativeAOT. Rust fans pointed to ultra-fast tools like swc and Turbo. However, the main practical issue lies elsewhere: TypeScript 7.0 does not yet expose the old programmatic Compiler API that dozens of plugins, linters, and code generators rely on. Until the ecosystem catches up, those tools have to stay on version 6 or use a bridge package. Even so, from an engineering standpoint, betting on Go paid off completely: the problem was solved without rewriting the entire architecture.

Where the real boundary lies between Go and Rust

Whenever people compare Go and Rust, the discussion quickly turns into synthetic benchmarks. In real teams, the math is much simpler: first you measure how fast new hires get productive, and then you check whether your service actually hits garbage collection limits.

Go was designed from day one as a simple, practical tool. Rob Pike openly explained who they built it for: Google kept hiring new graduates who knew Java or Python and had no interest in writing a thesis on type theory. The language had to be easy to pick up right away. That is why it has only 25 keywords, a tiny spec, a single auto-formatter gofmt (so teams stop arguing over spaces and braces), and automatic garbage collection. In practice, a junior developer writes readable Go in a couple of days, and an experienced backend engineer hits full speed in two to three weeks.

Rust takes the opposite path. With no garbage collector, the compiler guarantees memory safety through its built-in inspector called the borrow checker. In everyday terms, imagine a strict warehouse manager who checks the paperwork on every box before the shift even starts: who owns it right now, who borrowed it to read, and whether two workers are trying to repack the same crate at once. That strictness kills memory leaks and data races at compile time. The price is ramp-up time: on top of ownership and borrowing, developers have to master lifetimes in structs, traits, macros, and async runtime choices.

The numbers back this up. In the State of Rust Survey 2025, 41.6% of respondents named the language's growing complexity as their top worry for its future (down slightly from 45.2% a year earlier). It ranks second only to slow industry adoption (42.1%), even though 57.6% of respondents are happy with the overall pace of progress. An internal Google study from 2022 is even clearer: two-thirds of engineers felt confident modifying Rust code after about two months, and only half returned to their usual productivity after four months. And that was inside Google, with dedicated courses, mentors, and polished code reviews. At a typical company without that safety net, onboarding takes even longer.

Go has its own traps, though they tend to surface later under production load rather than in week one. The classic trio includes tricky nil interfaces (where the underlying value is empty, yet the interface itself is not nil), subtle slice aliasing (where two slices share an array and editing one corrupts the other), and goroutine leaks that sit quietly in memory until the service restarts.

Still, the main technical divide between the two languages is the garbage collector. As long as GC pauses and memory overhead fit within your SLAs, Go handles web services, CLI tools, and cloud infrastructure with ease. Trouble starts when every single millisecond of latency counts. Discord is the textbook example: the team rewrote a hot service from Go to Rust after hitting periodic latency spikes from garbage collection. Crucially, they only did that after squeezing everything they could out of standard optimizations.

Infographic cutaway of Go and Rust runtime architectures: a memory module with Green Tea GC page blocks and a borrow checker ownership controller.

Moreover, that boundary keeps shifting because Go's runtime keeps improving. GC pauses have long stayed under a millisecond, GOMEMLIMIT introduced soft memory caps, and in Go 1.26, the Green Tea GC became the default collector. As the Go team explains in their Green Tea GC deep dive, the new collector scans memory in 8-kilobyte pages using SIMD and AVX-512 vector instructions instead of chasing individual objects. Without changing a single line of application code, this cuts GC CPU overhead by 10-40%. If an unusual workload ever hits a regression, you can roll it back with a single build flag: GOEXPERIMENT=nogreenteagc.

How do you know when Go is actually too tight for your workload? Look at what your team spends time on in pull requests. If engineers spend their days rewriting everything with sync.Pool to reuse buffers, stripping pointers, packing structs into flat []byte arrays, moving memory off-heap via mmap, or wiring up jemalloc through cgo, you are already fighting the language. Twitch produced the most famous example of this in 2019: their Go service allocated an empty 10-gigabyte []byte array at startup. They called it a memory ballast—like loading ten tons of sand into a truck bed so the suspension triggers less often over bumps. That huge empty block simply tricked the garbage collector into running less frequently. The Go team even experimented with manual memory arenas in 1.20, but later froze the idea as a public API.

There are also areas where Rust wins without debate: embedded electronics, tiny WebAssembly modules, ultra-compact binaries, and libraries embedded inside another process (such as Python or C++). For the TypeScript compiler, none of those constraints mattered.

CriterionGoRust
Team onboarding25 keywords, productive in 2-3 weeksSteep: ownership, lifetimes, 2-4 months to adapt
Memory managementAutomatic GC (Green Tea GC by default in Go 1.26)Manual model without GC, strict borrow checker
Latency predictabilityPauses under 1 ms, though spikes are possible under tight SLAsConsistent latency and exact memory control
Hidden production risksNil interfaces, slice aliasing, goroutine leaksComplex graph refactoring, temptation to use unsafe
Where it shinesWeb backends, cloud infrastructure, CLIs, microservicesHot-path services, embedded systems, WASM, engines and bundlers

In short: open a profiler first, fix obvious allocations, and tune the runtime. Moving to Rust only makes sense when fighting the garbage collector becomes your team's main job.

How JavaScript builds quietly moved to Go and Rust

The funniest part about frontend debates today is that when you run a standard JavaScript project, most of the heavy lifting behind the scenes is no longer written in JavaScript. Look inside node_modules/.bin: you will find thin wrappers and symlinks. The actual executables for your OS and CPU are quietly downloaded as separate packages via optionalDependencies in package.json. That is how esbuild works, for example: npm pulls down the right native binary for Linux, macOS, or Windows. As a result, everyday commands like next build, vite build, or npx tailwindcss run compiled Go or Rust code.

Over 2025 and 2026, this quiet shift reached almost every layer of frontend tooling:

  • On October 21, 2025, Next.js 16 shipped with the Rust-based Turbopack bundler enabled by default.
  • On March 12, 2026, Vite 8 dropped its old dual setup (esbuild for dev and Rollup for production) and moved to a unified Rust core built on Rolldown and the Oxc parser.
  • In May 2026, stable Rolldown 1.0 arrived, beating Rollup by 10-30x in several scenarios while keeping plugin compatibility.
  • The fast Rust linter Oxlint has already been adopted by Shopify, Airbnb, and Mercedes-Benz.
  • VoidZero, the company Vue creator Evan You built around Vite, Vitest, Rolldown, and Oxc, raised $12.5 million in a Series A round led by Accel.

Official Vite card—a JavaScript ecosystem build tool that moved to the Rust bundler Rolldown in version 8 (Source: vite.dev)

Rust clearly leads in the sheer number of new frontend tools. Still, Go holds two major heavyweights in this space: esbuild (its creator Evan Wallace noted he simply found Go faster and more pleasant to write) and the new tsgo compiler. While teams pick different bundlers, type-checking runs in nearly every TypeScript project, making tsgo one of the most widely used native tools on the web.

The exact same shift happened in Python, where the Rust-based package manager uv and linter Ruff replaced older, slower tools within a couple of years. Meanwhile, product applications themselves haven't moved: UIs are still built with TypeScript, React, and Vue. Native languages took over the 'build floor'—the utilities where instant startup, multi-core scaling, and low memory use matter most.

Historical boomerang: how Angular launched TypeScript

There is a neat historical irony in TypeScript's move to Go that is easy to miss if you don't remember what happened ten years ago.

In 2010, Google introduced AngularJS. After manual jQuery DOM wrangling, two-way data binding and dependency injection felt like a breath of fresh air, and by 2014 it was a top choice for single-page apps. But its screen-update mechanism (the digest cycle) hit a ceiling: large pages slowed to a crawl. In October 2014, the team announced Angular 2 as a complete rewrite with no smooth migration path. At ng-europe, slides even showed a tombstone reading RIP $scope and bade farewell to controllers. For thousands of developers, it sounded like a sentence: old code would have to be rewritten almost from scratch.

At first, Google planned to build Angular 2 on its own AtScript language (even though it already had Dart and Closure). Then in March 2015, something unexpected happened: Google and Microsoft engineers struck a deal. TypeScript added decorators and metadata, AtScript was quietly shelved, and Angular 2 moved entirely to TypeScript.

Up to that point, TypeScript had been a fairly niche project. Angular's bet gave it a massive public showcase and pushed it into the mainstream. Exactly ten years later, the symmetry is complete: in 2015 Google picked Microsoft's language to power Angular, and in 2025 Microsoft picked Google's language to speed up the TypeScript compiler.

Angular itself paid a steep price for that long rewrite. Nearly two years passed before the final v2 release in September 2016, marked by breaking betas and a router rewritten three times. Tired of waiting, many teams left for React, and former Google engineer Evan You created Vue from the best parts of AngularJS he missed. Support for the original AngularJS officially ended on December 31, 2021.

Today, the framework is still alive, just with a smaller market share. In the 2026 Stack Overflow survey, 41.5% of developers actively used React, compared to 16% for Angular. Angular remains strong in large enterprises and banks, especially in Europe and India, and Google keeps evolving it: Angular 21 made zoneless mode (without heavy Zone.js) the default and added experimental Signal Forms. The bigger takeaway is clear: Angular did more for TypeScript than TypeScript did for any single version of Angular. The language outlived AtScript, Dart's web ambitions, the original AngularJS, and now even the first implementation of its own compiler.

Go's maturity: 14 years without breaking changes and why it rules in Russia

Calling Go 'young and trendy' hasn't been true for a long time. It was announced in November 2009, and version 1.0 shipped in March 2012. In 2026, it has over fourteen years of stable production use—the exact same age Java had when Go first appeared.

The real trump card isn't age, though, it's the Go 1 compatibility promise in place since 2012. New releases arrive twice a year, yet old code keeps compiling and running without painful rewrites. For businesses, that predictability outweighs clever syntax tricks. Unsurprisingly, Go underpins modern cloud infrastructure: Docker, Kubernetes, Terraform, Prometheus, and etcd. Industry estimates suggest the vast majority of CNCF projects are written in Go, and now the TypeScript compiler joins that list.

Share of CNCF projects written in Go

~75%Go projects

Programming languages rarely die just because a smarter or faster rival shows up. D has existed since 2001 without taking Go's market. Rust has been stable since 2015 and Zig since 2016; they simply claimed neighboring niches with strict memory requirements or C replacement goals. Languages usually fade alongside their platform or era: Perl lost the web, and Objective-C gave way to Swift when Apple shifted developers to a new stack. Meanwhile, ancient COBOL still runs inside banking cores. Displacing Go would require rewriting half the cloud and retraining millions of engineers. It does face risks—it still relies heavily on Google's backing, and some CLI tools are moving to Rust (Turborepo was rewritten from Go to Rust)—but its core cloud footprint remains solid.

According to JetBrains' 2025 research, roughly 2.2 million professional developers use Go as their primary language, and counting part-time users brings the audience past 5 million, with another 11% planning to learn it. In the 2026 Language Promise Index, Go holds fifth place behind TypeScript, Rust, Python, and C++.

Interestingly, Go found very different roles in different parts of the world. In the US and Western Europe, it mostly powers infrastructure and high-load proxies (Uber, Cloudflare, Twitch), while standard enterprise product backends still lean on Java, C#, and Node.js.

In Russia, the picture is completely different: Go became the main workhorse for product backends. T-Bank, Avito, Ozon, Wildberries, and VK all build core services on it. Two historical factors lined up. First, Russian big tech shifted to microservices en masse between 2014 and 2018. By then, Go was already mature, and local companies didn't have the massive piles of legacy Java that Western corporations carried. Second, Avito, VK, and Badoo had huge PHP codebases. Moving PHP teams onto concise Go was vastly easier and cheaper than dragging them into heavy Java ecosystems. From there, the market flywheel spun up: big companies opened Go roles, developers learned the language for those jobs, courses and conferences followed, and new startups picked Go simply because hiring was straightforward.

The exact same pattern played out in Southeast Asia (Grab, Gojek, Shopee), Latin America (MercadoLibre), and China's ByteDance, the owner of TikTok. The common thread everywhere is clear: large tech companies that scaled after 2012 and could pick tools without legacy baggage.

AI agents vs. architecture: manual TypeScript and the $165,000 Bun port

Now that AI models can generate tens of thousands of lines of code overnight, you might think old debates about onboarding speed and rewrite costs no longer matter. Throw a swarm of agents at an old service and wake up to clean Rust code. It sounds great on paper, but real data from 2025-2026 tells a much more nuanced story.

First, AI does not level the playing field for niche languages; instead, it locks in the lead of established, widely used ones. The same JetBrains 2025 survey found that over 70% of Go developers regularly use AI tools (across the broader market, adoption reaches 85%). Hejlsberg compared large language models to giant machines that remix existing human code with a bit of extrapolation. When a language has a huge open-source corpus like Go, Python, or TypeScript, models write it reliably. On newer niche languages, models make more mistakes, so fewer developers pick them for agentic workflows, which slows down the growth of training examples even further.

Second, look at the contrast between two major recent ports. The TypeScript 7.0 port to Go started in October 2024 almost without LLMs: the team built prototypes by hand, wrote their own TypeScript-to-Go translator, and cleaned up the output manually, using AI only for minor tasks.

By contrast, porting the Bun JavaScript runtime from Zig to Rust—detailed in the Bun blog—became a real stress test for agentic engineering. Anthropic acquired the project in December 2025. One reason to leave Zig was its community's strict no AI contributions policy, alongside a desire for stronger type and memory checks. The original codebase had around 535,000 lines of Zig.

Over 11 days, up to 64 Claude Code agents working in parallel across separate git worktrees produced 6,778 commits. At API rates, that burned roughly $165,000 (5.9 billion uncached input tokens, 690 million output tokens, and 72 billion cached reads). The total diff topped one million lines, yielding around 780,000 lines of Rust that passed 99.8% of more than 100,000 tests.

Those numbers look incredible—until you inspect the code and count the unsafe blocks. Remember: unsafe in Rust is an escape hatch where the programmer (or agent) tells the compiler, 'Look away, I'm managing pointers and memory myself here.' Look at the gap between the agent-built port and a comparable hand-written Rust project.

Number of unsafe blocks in Rust code

Bypassed safety checks made up about 4% of the new codebase, roughly 27,000 lines—a massive gap compared to normal hand-written Rust. And this isn't just because the model was weak. Three systemic causes came together:

  1. The original Zig code relies on manual memory management and raw pointers. Translating that directly almost automatically turns into unsafe. Getting genuinely safe Rust requires rethinking data ownership across the entire program.
  2. The agents were given a clear target—pass over 100,000 tests on a tight deadline—without a strict cap on unsafe blocks. When the goal is 'green tests by the deadline', wrapping tricky code in unsafe is the fastest shortcut past the borrow checker.
  3. Global memory ownership (deciding where &mut works, where Rc is needed, and where to transfer ownership) depends on how data flows across the whole program. An agent only sees the slice inside its context window. You can never eliminate unsafe completely in a runtime like Bun due to JavaScriptCore bindings, system calls, and SIMD. Still, a healthy project has dozens of those spots, not thousands.

Future models will likely write cleaner Rust: unsafe counts are easy to add to training rewards, and tools like clippy and miri can automatically flag risky patterns. The Bun case already sets a clear benchmark for future automated ports.

Meanwhile, AI changes the ownership cost of Go and Rust in different ways. In Go, models wipe out the main tedious chore—generating repetitive if err != nil checks instantly. However, the Go compiler doesn't catch data races or nil panics, so generated code can pass tests and still crash quietly in production. Rust's compiler provides much stronger guardrails, yet when a service goes down at 3 a.m. on call, a human still has to read, debug, and fix that generated code. At that moment, Go's plain readability tips the scale again.

Besides, Bun's economics were a one-off case: the team already had a massive suite of 100,000 tests, a policy clash with Zig, and an owner with vast compute resources. A typical product Go service almost never has that setup. If the garbage collector isn't choking your service, rewriting it in Rust—even with an army of agents—means signing your team up for much more expensive maintenance.

Three questions before you start a rewrite

Strip away the hype, trends, and third-party benchmarks, and the story of TypeScript 7.0, frontend bundlers, and the Bun port boils down to basic engineering math. AI agents have made the act of rewriting cheaper, yet they don't repeal the laws of memory, architectural complexity, or the cost of human maintenance.

Before proposing a move from Go to Rust (or vice versa), run your project through this short filter.

Checks before switching languages

  • Garbage collection genuinely hurts your latency or memory targets, and a profiler proves it even after basic optimizations and runtime tuning (including modern GC and GOMEMLIMIT).
  • You have calculated the true team cost: how many months current developers will need to adapt, how quickly you can hire on the market, and who will handle 3 a.m. on-call pages in the new stack.
  • You can port the existing codebase without redesigning the entire architecture and data structures at the same time—or the business is ready to pay for a double overhaul and a feature freeze.

For the TypeScript compiler, honest answers to these three questions pointed straight to Go, delivering massive speedups without years of architectural pain. For hot-path services like Discord or the core of Rolldown, the answers pointed to Rust, where it fully earned its steeper learning curve.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 10