Project Corsa: Microsoft's New Native TypeScript Compiler

Microsoft's Project Corsa is a new native TypeScript compiler built for speed and efficiency. It dramatically reduces compilation time while staying fully compatible with TypeScript, offering faster builds and improved developer productivity.

Project Corsa:  Microsoft's New Native TypeScript Compiler

Microsoft has embarked on a significant transformation of its TypeScript programming language by developing a native compiler and toolset, aiming to enhance performance and developer productivity. This initiative involves porting the existing TypeScript compiler from JavaScript/TypeScript to Go, promising substantial improvements in compilation speed and resource efficiency.

The Need for a Native Compiler:

As TypeScript has grown in popularity, developers working on large-scale projects have encountered performance bottlenecks, including slow build times and high memory consumption. These challenges can hinder development workflows and affect productivity. Recognizing these issues, Microsoft has undertaken the task of creating a native implementation of the TypeScript compiler to address these performance concerns.

Impressive Performance Gains:

The native compiler has demonstrated remarkable performance enhancements across various codebases:

CodebaseSize (LOC)JavaScript Compiler TimeNative Compiler TimeSpeedup
VS Code1,505,00077.8 seconds7.5 seconds10.4x
Playwright356,00011.1 seconds1.1 seconds10.1x
TypeORM270,00017.5 seconds1.3 seconds13.5x
date-fns104,0006.5 seconds0.7 seconds9.5x
tRPC18,0005.5 seconds0.6 seconds9.1x
rxjs2,1001.1 seconds0.1 seconds11.0x

These results indicate that the native compiler can reduce build times by approximately 10 times, significantly enhancing the efficiency of development processes.

Impact on Developer Experience:

Beyond faster build times, the native compiler offers additional benefits:

  • Improved Editor Performance: Developers can expect quicker editor startup times and more responsive code navigation features, such as renaming variables and finding references. For instance, loading the entire VS Code project in an editor has been reduced from 9.6 seconds to 1.2 seconds using the native language service.
  • Reduced Memory Usage: Preliminary observations suggest that the native implementation consumes roughly half the memory compared to the current JavaScript-based compiler, contributing to a smoother development experience.

Timeline and Future Developments:

Microsoft plans to release a preview of the native compiler capable of command-line type-checking by mid-2025, with a feature-complete solution for project builds and language services expected by the end of the year. This native implementation is slated to be part of TypeScript 7.0 upon reaching parity with the existing compiler. In the interim, Microsoft will continue to maintain the JavaScript-based compiler through the 6.x releases to ensure stability and support for ongoing projects.

Community Engagement and Feedback:

Microsoft is actively seeking feedback from the developer community to refine the native compiler. Developers are encouraged to build and run the Go code from the new repository, which is available under the same license as the existing TypeScript codebase. Regular updates will be provided as new functionality becomes available for testing.

The development of a native TypeScript compiler represents a significant advancement in addressing performance challenges associated with large-scale TypeScript projects. By leveraging a native implementation, Microsoft aims to provide developers with faster build times, improved editor responsiveness, and reduced memory usage, thereby enhancing the overall development experience. This initiative underscores Microsoft's commitment to evolving TypeScript in alignment with the growing demands of modern software development.

For a more in-depth discussion on this topic, you might find the following resources insightful:

A 10x Faster TypeScript - TypeScript
Embarking on a native port of the existing TypeScript compiler and toolset to achieve a 10x performance speed-up.

Liked it ?

Read more