DiscoverSyntax - Tasty Web Development Treats884: Typescript Just Got 10x Faster
884: Typescript Just Got 10x Faster

884: Typescript Just Got 10x Faster

Update: 2025-03-111
Share

Digest

This podcast details the significant performance improvements achieved by porting the TypeScript compiler and toolset to native code using Go. The 10x speed increase impacts the entire compilation pipeline, from parsing and type checking to code emission, benefiting both command-line users and IDE integrations like VS Code. The improved speed enables faster loading times, near-instantaneous type checking, and opens doors for advanced AI-assisted code analysis. The team discusses the challenges of porting versus rewriting, the choice of Go over other languages like Rust (due to its garbage collection, concurrency support, and suitability for TypeScript's functional style), and the porting methodology (initially manual, then automated). They address concerns about induced demand and the potential for increased type complexity, highlighting the importance of responsible type system usage. The podcast also explains the use of shared memory concurrency for parallelization, particularly in embarrassingly parallel tasks like parsing. Finally, the team outlines future plans, including a complete command-line compiler replacement, a new Language Server Protocol (LSP)-based language server, and further AI integration. The timeline for release is discussed, with a command-line compiler replacement targeted for the end of spring and a full language server by the end of the year.

Outlines

00:00:00
TypeScript Compiler's 10x Performance Boost and Native Code Port

The TypeScript compiler and toolset have been ported to native code, resulting in a 10x performance improvement across all compilation phases. This significantly speeds up the entire compilation process.

00:00:06
Impact on Editor Integration and Language Services

The performance improvements extend to editor integrations like VS Code, leading to faster loading times and near-instantaneous type checking. This also opens opportunities for advanced features like on-the-fly AI-assisted code analysis.

00:03:12
Addressing Induced Demand and Type System Considerations

The podcast discusses the potential for increased type complexity due to the speed improvement and the need for responsible use of the powerful type system to avoid performance regressions. Concerns about the Turing-completeness of the type system and potential infinite loops are addressed.

00:04:54
Development Process and Go's Role

The development process is detailed, including the challenges of porting versus rewriting and the reasons for choosing Go (native executable support, garbage collection, concurrency). The suitability of Go for TypeScript's functional style is highlighted.

00:20:28
TypeScript Codebase Structure and Porting Methodology

The discussion focuses on the TypeScript codebase's functional style and its alignment with Go. The porting process, initially manual then automated, and challenges in adapting the JavaScript object model to Go are explained.

00:03:32
Parallelization Strategies and Concurrency

The podcast explains how shared memory concurrency is leveraged for significant speed improvements, especially in embarrassingly parallel tasks like parsing. The limitations of JavaScript's concurrency model are contrasted with Go's capabilities.

00:42:34
Addressing Slow Parts of TypeScript and Future Optimizations

Specific slow parts of TypeScript, particularly the type checker, are addressed, along with optimization strategies like isolated declarations and "no-check" mode.

00:49:09
Large Codebases, Future Plans, and Timeline

The episode explores performance challenges in large TypeScript codebases and how the new compiler addresses them. Future plans, including increased AI integration and improved tooling, and the release timeline are discussed.

Keywords

TypeScript Compiler


The program that translates TypeScript code into JavaScript; significantly improved performance due to a native code port.

Native Code Compilation


Compiling directly to machine code for faster execution.

Go Programming Language


The language used for the TypeScript compiler port, chosen for its native executable support, concurrency, and garbage collection.

Shared Memory Concurrency


A programming model enabling efficient parallel processing, crucial for speed improvements.

Type Checker


The part of the compiler verifying type correctness; a major performance bottleneck previously improved significantly.

AI-assisted Code Analysis


Using AI to enhance code analysis, enabled by speed improvements.

Induced Demand


Increased usage due to infrastructure improvements, potentially negating benefits.

Language Server Protocol (LSP)


Go's native executable support, garbage collection, concurrency features, and alignment with TypeScript's functional style.

Q&A

  • What is the primary benefit of porting the TypeScript compiler to native code?

    A 10x performance improvement across all compilation phases, reducing build times.

  • Why was Go chosen for the port?

  • How does shared memory concurrency contribute to performance gains?

    Allows multiple threads to work simultaneously on different parts of the compilation process.

  • What are the future plans for the TypeScript compiler and language service?

    A complete command-line compiler replacement, a new LSP-based language server, and increased AI integration.

  • What are some challenges in achieving a 10x performance improvement?

    Optimizing the inherently complex type checking phase.

  • When will the new compiler be available?

    A command-line compiler replacement is targeted for the end of spring, a full language server by year's end.

Show Notes

Wes and Scott talk with Anders Hejlsberg and Daniel Rosenwasser about TypeScript’s leap to native code. They discuss the challenges, trade-offs, and the decision to port TypeScript to Go, unlocking faster compilation, better concurrency, and new possibilities for AI-assisted development.

Show Notes Sick Picks Shameless Plugs Hit us up on Socials!

Syntax: X Instagram Tiktok LinkedIn Threads

Wes: X Instagram Tiktok LinkedIn Threads

Scott: X Instagram Tiktok LinkedIn Threads

Randy: X Instagram YouTube Threads

Comments 
00:00
00:00
1.0x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

884: Typescript Just Got 10x Faster

884: Typescript Just Got 10x Faster

Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers