Microsoft Announces Native Typescript Compiler Port for 10X Performance Boost

MMS Founder
MMS Bruno Couriol

Article originally posted on InfoQ. Visit InfoQ

Microsoft’s TypeScript team has announced an experimental native port of the TypeScript compiler (tsc), dubbed tsc-go, aimed at providing 10x improvement on build time, drastically reducing cold editor startup times, and substantially improving memory usage. This initiative explores running the compiler (written in Go) without the Node.js runtime overhead.

Anders Hejlsberg, lead architect of the TypeScript project, explained the motivation behind the port as follows:

The core value proposition of TypeScript is an excellent developer experience. As your codebase grows, […] in many cases TypeScript has not been able to scale up to the very largest codebases. Developers working in large projects […] have to choose between reasonable editor startup time or getting a complete view of their source code […] New experiences powered by AI benefit from large windows of semantic information that need to be available with tighter latency constraints. We also want fast command-line builds to validate that your entire codebase is in good shape.

The standard tsc compiler running on Node.js, incurs noticeable startup time, especially on initial execution, for large projects or frequent, small builds. The new, experimental TypeScript compiler is written in Go and compiled to native code that runs without Node.js startup overhead.

The blog announcement mentions a reduction in type-checking time of VS Code’s 1 MLOC codebase from 77 seconds, down to 7.5 seconds, i.e., a 10x improvement. The same ratio is observed on the Playwright codebase (356,000 LOC) with a time reduced from 11s to 1s. Microsoft also reports maintaining this ratio on smaller codebases, with RxJS (2,100 LOC) seeing a reduction in type-checking time from 1,1s to 0,1s. The blog post does not provide Improvement figures related to incremental builds.

The TypeScript team also reports an 8x improvement in project load time in editor scenarios for the Visual Studio codebase and expects the same ratio to be constant over other codebases. Developer experience is poised to be improved as the time between opening the code editor and being ready to type into a fully loaded codebase is significantly reduced.

The native port (codename Corsa) is still considered experimental and still misses many features, including incremental builds (cf. What works so far). The blog announcement explains that when the native codebase has reached sufficient parity with the current TypeScript, it will be released as TypeScript 7.0, with a mindful migration path to former versions:

We’ll still be maintaining the JS codebase in the 6.x line until TypeScript 7+ reaches sufficient maturity and adoption.

Developer reactions on platforms like Reddit and Hacker News asked about the rationale behind choosing Go over Rust. Ryan Cavanaugh, TypeScript dev lead, provided a detailed answer that developers are invited to check. To quote an excerpt:

In the end, we had two options – do a complete from-scratch rewrite in Rust, which could take years and yield an incompatible version of TypeScript that no one could actually use, or just do a port in Go and get something usable in a year or so and have something that’s extremely compatible in terms of semantics and extremely competitive in terms of performance.

In addition to the blog post, developers are encouraged to review the YouTube video in which Hejlsberg details the ongoing TypeScript port effort. Developers can also visit the GitHub repository for the development of the native port of TypeScript. A preview build is available on npm as @typescript/native-preview. A preview VS Code extension is available on the VS Code marketplace.

The project is released under the Apache License 2.0 and welcomes contributions and suggestions. For details, visit Contributor License Agreements. The project follows the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ.

About the Author

Subscribe for MMS Newsletter

By signing up, you will receive updates about our latest information.

  • This field is for validation purposes and should be left unchanged.