Hold onto your keyboards, folks! In a move that’s got the programming world buzzing, Microsoft has decided to port the TypeScript compiler to Go, promising a whopping 10x increase in compile speed. But here’s the twist: they chose Go over Rust, and that’s got everyone talking. Why Go? Why not Rust, the darling of systems programming? Let’s dive into this juicy debate and find out what’s really going on.

Also Read: React vs Svelte 2025

Background on TypeScript

First things first, let’s remember what TypeScript is. Created by Microsoft in 2012, TypeScript is a superset of JavaScript that adds static typing, making it easier to build large-scale applications. It’s become incredibly popular, with millions of developers using it daily. However, as codebases grow larger, the TypeScript compiler has started to show its age, with slow compilation times and high memory usage becoming significant pain points.

The Decision to Port to Go

In March 2025, Microsoft announced that they are porting the TypeScript compiler and toolset to Go, with the goal of achieving 10x faster compile speeds and significantly reduced memory usage. This native implementation is expected to drastically improve editor startup times and overall developer experience, especially for large codebases. The project, codenamed “Corsa,” is still in progress, with 80% of the functionality rewritten since August 2024, though features like JSDoc and JSX are not yet supported.

But why Go? Why not Rust, which is often praised for its performance and safety features? Let’s explore the reasons.

Why Microsoft Chose Go for TypeScript

Microsoft’s choice of Go over Rust might seem surprising at first, but there are solid reasons behind it. According to the TypeScript team, several factors played a role in this decision, as detailed in their GitHub discussions and an interview with Anders Hejlsberg, TypeScript’s creator.

Structural Compatibility

Go’s syntax and structure are more similar to TypeScript’s existing codebase, which is written in TypeScript (essentially JavaScript). This similarity made the porting process more straightforward compared to Rust, which would require a more fundamental rethinking of the codebase due to its strict memory management rules. Go’s idiomatic style closely resembles TypeScript’s functions and data structures, allowing for a smoother transition.

Memory Management

TypeScript relies heavily on garbage collection, and Go provides an efficient garbage collector that aligns well with TypeScript’s needs. Rust, on the other hand, requires manual memory management through its ownership model, which would have necessitated significant changes to the compiler’s architecture—something not ideal for a porting project. Go’s garbage collector minimizes memory management concerns, especially since the compiler doesn’t need to optimize for nanosecond latency.

Graph Processing

The TypeScript compiler deals extensively with abstract syntax trees (ASTs), which are graph-like structures. Go handles graph traversal and processing very well, making it a natural fit for this task. It excels in ergonomic handling of graph processing, specifically traversing trees in upward and downward walks involving polymorphic nodes, aligning well with the JavaScript version’s needs.

Ease of Use and Learning Curve

Go is known for its simplicity and ease of learning, especially for developers familiar with C-like syntax. This makes it easier for the TypeScript team and potential contributors to work with the new codebase. Rust, while powerful, has a steeper learning curve due to its unique features like ownership and lifetimes. For a project that needs to be maintained by a team over time, Go’s accessibility is a huge plus.

Concurrency

Go’s built-in support for concurrency through goroutines and channels is beneficial for the TypeScript compiler, which can take advantage of multi-core processors to speed up compilation. In the interview, Hejlsberg noted that Go’s multi-threading provides a 3x performance boost, with another 3x from structs improving memory access, contributing to the overall 10x speedup. Rust also supports concurrency, but Go’s approach is more straightforward for this use case.

Porting vs. Rewriting

This was a port, not a rewrite. The goal was to keep the new codebase as similar as possible to the existing one in terms of semantics and structure. Go allowed for this direct mapping, whereas Rust would have required a complete redesign, which wasn’t feasible given the 100 man-years invested in the current codebase. The porting effort focused on maintaining compatibility, both algorithmically and structurally.

Hejlsberg emphasized that while Rust is an excellent language, it wasn’t the best fit for this project due to the need for a smooth transition and maintaining compatibility with the existing codebase. As Ryan Cavanaugh, TypeScript’s development lead, noted on Reddit, “Rust succeeds wildly at its design goals, but ‘is straightforward to port to Rust from this particular JavaScript codebase’ is very rationally not one of its design goals.”

Performance Benefits of Porting TypeScript to Go

The port to Go is expected to bring substantial performance improvements. Early benchmarks show that the Go-based TypeScript compiler can achieve up to 10x faster build times for large codebases, with memory usage roughly halved. Here are specific examples from Microsoft’s announcement:

ProjectLines of CodeCurrent Time (s)Native Time (s)Speedup
VS Code1,505,00077.87.510.4x
Playwright356,00011.11.110.1x
TypeORM270,00017.51.313.5x
date-fns104,0006.50.79.5x
tRPC18,0005.50.69.1x
rxjs2,1001.10.111.0x

These gains are attributed to Go’s native performance, multi-threading capabilities, and efficient handling of data structures. Editor responsiveness for operations like completion lists, quick info, and go-to-definition will also see significant speed improvements. Microsoft plans to preview command-line type-checking in Go-based tsc by mid-2025, with a feature-complete implementation by year-end.

Go vs Rust: The Community Debate

The announcement sparked significant discussion in the programming community, with many developers expressing surprise at the choice of Go over Rust. Some were disappointed, given Rust’s reputation for performance and safety. For example, an X post by @archiexzzz humorously noted, “More shocking than TypeScript getting 10x speedup is they didn’t write it in Rust.” Others, like @rakyll, defended Go’s suitability, stating, “Go is downplayed. The TypeScript compiler is a perfect use case where it’s a good fit.”

However, many appreciated the pragmatic reasons behind Microsoft’s decision. As @nickchapsas posted on X, “The TypeScript team chose well to go with Go,” highlighting that even though Microsoft promotes C# as a versatile language, Go was better suited for this task. The debate reflects the broader Go vs Rust discussion, with each language having strengths that suit different contexts.

Why Not C# or Other Languages?

Microsoft also considered C# but quickly discarded it due to its lack of well-tested native-first support across all desired platforms, as noted by Cavanaugh. Go’s cross-platform support and native code generation made it a stronger candidate. Other languages were evaluated, but Go consistently performed best when considering compatibility, performance, and ease of use for this specific porting effort.

Future Implications

This move could have broader implications for the programming language landscape:

  • Go is a viable choice for performance-critical applications like compilers, challenging the notion that only low-level languages like C++ or Rust are suitable.
  • Other projects may consider Go for similar reasons: performance, ease of use, and cross-platform support.
  • For TypeScript developers, this means faster compilation times and a better development experience, especially with large codebases.
  • The shift to Go opens up possibilities for new features, such as better integration with the Language Server Protocol (LSP) and potential LLM-powered tools for enhanced code understanding.

The original TypeScript codebase will continue to be supported for years post-transition, ensuring a smooth migration. The Go-based codebase is expected to become TypeScript 7.0 once it reaches feature parity, with TypeScript 6.0 introducing deprecations to align with the native implementation.

Conclusion

Microsoft’s decision to port TypeScript to Go instead of Rust was driven by practical considerations such as compatibility, ease of porting, and specific performance needs. While Rust is an excellent language, Go proved to be the better fit for this project due to its similarity to the existing codebase, efficient memory management, and developer-friendly features. As the project progresses, TypeScript developers can expect significant improvements in performance, making TypeScript even more powerful and efficient.


What do you think about this decision? Would you have chosen Go over Rust for this project?