Project Corsa: Revolutionizing TypeScript Compiler with Go for Lightning-Fast Performance
Key insights
- 🚀 🚀 Introduction of Project Corsa aims to port TypeScript to native code for enhanced performance.
- 🛠️ 🛠️ Current challenges include performance issues and memory constraints with TypeScript written in itself.
- ⚙️ ⚙️ Over 100,000 lines of code have been successfully ported to Go, improving compile performance significantly.
- 🔄 🔄 The new Go-based compiler maintains the same error reporting principles as the old TypeScript version.
- 📈 📈 The implementation of a new language service in VS Code enhances performance with LSP architecture.
- ⚡ ⚡ New compiler achieves up to 8X faster compile times by utilizing concurrency.
- 🔍 🔍 Type checking is parallelized, leveraging multiple checkers for improved speed and memory usage.
- 🤖 🤖 Future plans for the compiler include incorporating AI features for enhanced type checking.
Q&A
How can users get involved with Project Corsa? 📣
Users are encouraged to try out the new TypeScript compiler available in the GitHub repository and to report any issues they encounter. This collaborative approach helps improve the compiler further as it transitions towards completion.
What future enhancements are planned for the TypeScript compiler? 🚀
Future developments include completing the command-line compiler, which is 80% finished. Plans also involve adding support for various JavaScript features and incorporating AI functionalities for improved type checking and semantic analysis.
How does parallelization affect the new compiler? ⚙️
The new compiler is designed to run multiple type checkers in parallel, which significantly speeds up file processing. Currently, four type checkers are utilized to handle subsets of files efficiently while balancing memory usage.
What are the performance gains of the new TypeScript compiler? 🚀
The new TypeScript compiler achieves compilation speeds up to 8 times faster than the old version. For example, while the old compiler takes around 7 seconds to compile 250,000 lines of code, the new compiler can do so in less than 1 second when utilizing concurrency.
How is the new language service integrated into Visual Studio Code? 🔄
The new language service incorporates Language Server Protocol (LSP) architecture, enhancing performance for functionalities like hover and go-to definition. Improvements have resulted in faster navigation and error detection, with a language server restart time of about 3 seconds.
What improvements does the new Go-based compiler offer? ⚡
The new compiler reduces compile times from approximately one minute to around 5.5 seconds. It is designed to maintain the same compiler semantics while improving efficiency, enabling significantly faster compilation, even for large codebases.
How much code has been ported to Go? 📦
The team has successfully ported over 100,000 lines of code to Go, which includes a completed scanner, parser, and binder. The type checker is 80% finished, and this transition has resulted in a performance improvement of over ten times for compilation speed.
What problems does Project Corsa address? ⚙️
Current challenges include performance issues, memory constraints, and JavaScript runtime limitations that hinder compute-intensive workloads like compilers. Common issues users face are out-of-memory errors when dealing with larger TypeScript projects.
What is Project Corsa? 🚀
Project Corsa is an initiative to port the TypeScript compiler from its current implementation into native code, specifically Go. This move aims to enhance performance, manage larger projects effectively, and address some of the performance issues related to TypeScript being written in itself.
- 00:00 Anders Hejlsberg discusses Project Corsa, which aims to port the TypeScript compiler to native code to improve performance and handle larger projects better. 🚀
- 02:10 The team has made significant progress in porting their codebase to Go, achieving over 100,000 lines of code ported with a performance improvement of more than 10x for compiling. 🚀
- 04:34 The speaker demonstrates the transition from an old TypeScript compiler to a new Go-based version, highlighting that while the code differs, the underlying behavior and error reporting principles remain consistent. 🔄
- 06:43 The video discusses the implementation of a new language service in Visual Studio Code that significantly improves performance and incorporates LSP architecture, resulting in faster navigation and error detection. 🚀
- 08:49 The new TypeScript compiler significantly improves performance through concurrency, achieving up to 8X faster compile times compared to the old compiler, even with limitations due to a large file. 🚀
- 11:04 The new compiler can run multiple type checkers in parallel, improving speed significantly while adjusting memory usage. A complete compiler is on the way, aimed to support various JavaScript features and incorporating AI functionalities. 🚀