SBN

TypeScript Achieves 10x Performance Boost with Native Compiler

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

Anders Hejlsberg, lead architect of the TypeScript project, emphasized the importance of developer experience, especially for large codebases. He stated that developers often face long startup times and must balance performance with visibility into their source code. The new compiler promises to address these issues by eliminating Node.js startup overhead.

The TypeScript team has reported significant improvements in type-checking time, noting that the time for VS Code’s 1 million lines of code (MLOC) codebase dropped from 77 seconds to 7.5 seconds—a 10x improvement. Similar results were observed in other projects, including Playwright and RxJS. The new port is still experimental and currently lacks features like incremental builds. For ongoing updates, developers can visit the GitHub repository for the development of the native port of TypeScript.

Announcing TypeScript Native Previews

The TypeScript team has made strides in porting the TypeScript compiler and toolset to native code, achieving a 10x speed-up on many projects. As of now, developers can access previews of the native TypeScript compiler via npm and a VS Code extension through the Visual Studio Marketplace.

To install the native compiler, run:

npm install -D @typescript/native-preview

The executable, tsgo, is designed to function like tsc. Developers can execute it similarly to the existing TypeScript compiler, facilitating testing and implementation of real-world projects.

The new “TypeScript (Native Preview)” extension can be installed from the VS Code Extension Marketplace. Users must enable the extension post-installation manually.

Despite its progress, the native preview lacks various functionalities present in stable versions of TypeScript, including command-line capabilities and certain editor features. Developers are encouraged to report issues via the GitHub issues page.

VS Code Extension

Image courtesy of Microsoft

TypeScript Just Got 10x Faster

The transition from JavaScript to Go for TypeScript's compiler marks a significant improvement in performance. The new implementation promises faster compilation speeds, lower memory usage, and better scalability for large projects. This change is a game-changer for developers who rely on TypeScript for type safety and structured code.

The new Go-powered tsc compiler introduces:

  • Faster compilation times
  • Enhanced multi-threading support, leading to reduced build times
  • Lower memory consumption

These enhancements directly impact the developer experience, especially for large-scale applications where traditional compilation methods may lead to performance bottlenecks.

TypeScript Performance

Image courtesy of DEV Community

What’s Next for TypeScript?

The focus is now on refining the native port to achieve feature parity with the existing TypeScript. The TypeScript team is actively working on expanding the capabilities of the new compiler, including improvements in type-checking support and editor responsiveness.

Progress includes enhancing support for JSX, JavaScript checking, and integrating a more robust language service. This shift aims to provide developers with a faster, more efficient coding environment while maintaining compatibility with existing TypeScript projects.

Given the technical advancements, enterprises looking to adopt TypeScript can expect significant improvements in development cycles. For secure user management and efficient single sign-on (SSO) solutions, consider SSOJet’s API-first platform, which features directory sync, SAML, OIDC, and magic link authentication.

TypeScript Roadmap

Image courtesy of DEV Community

Explore SSOJet's offerings to enhance your authentication processes. Visit ssojet.com to learn more about our services or contact us for personalized solutions.

*** This is a Security Bloggers Network syndicated blog from SSOJet authored by Ankit Agarwal. Read the original post at: https://ssojet.com/blog/typescript-achieves-10x-performance-boost-with-native-compiler/