Microsoft is revamping its TypeScript programming language with a native compiler and toolset. This effort seeks to address performance challenges, especially in large codebases, by porting the existing TypeScript compiler from TypeScript/JavaScript to the native language, Go.
TypeScript delivers an excellent developer experience, making your codebase more manageable as it grows. However, in large-scale projects, developers often face long load times, slow code checks, and a tough choice between fast editor startup or a complete project view.
With AI-driven tools requiring faster access to semantic data and quicker command-line builds, we're working to make TypeScript scale seamlessly—even for the biggest projects!
Currently, tsc is written in TypeScript and runs on Node.js, requiring a JavaScript runtime to execute. But soon, the TypeScript compiler will have a native port in Go—a statically compiled language!
Key takeaways from the FAQ include:
# Go was chosen for performance reasons. The team evaluated other languages like Rust, C and C++, but found Go to be the best fit for their needs.
# Compatibility is a major concern. The team is working to ensure that the native port is as compatible as possible with existing TypeScript code and configurations.
# Why a port instead of a rewrite? The primary constraint here relates to compatibility. Something we're keenly aware of is that TypeScript exemplifies Hyrum's Law: seemingly without exception, every single optimization, behavior, design limitation, bug, or just quirk of TypeScript is (intentionally or otherwise) relied on by some project or another.
How Much Faster?
Codebase | Size (LOC) | Current | Native | Speedup |
VS Code | 1,505,000 | 77.8s | 7.5s | 10.4x |
Playwright | 356,000 | 11.1s | 1.1s | 10.1x |
TypeORM | 270,000 | 17.5s | 1.3s | 13.5x |
date-fns | 104,000 | 6.5s | 0.7s | 9.5x |
tRPC (server + client) | 18,000 | 5.5s | 0.6s | 9.1x |
rxjs (observable) | 2,100 | 1.1s | 0.1s | 11.0x |