Potential solutions for the current parsing bottlenecks include:
- Information not available where needed (often caused by language features such as variable hoisting or inner functions)
The binary AST proposal borrows from the WebAssembly parsing approach, with a binary encoding split into three layers:
- Simple binary encoding of AST nodes using basic primitives
- Additional structural compression on the previous layer
- Generic compression algorithm
The team proposing binary AST implemented an early prototype using Mozilla’s SpiderMonkey engine by using a grammar based on an internal AST format.
The parsing improvements were much more significant, with the time required to create a full AST reduced by 70-90%.
FAQs in the proposal explain why it does not consider shipping native bytecode, why WebAssembly is not the answer to all of the web’s problems, and answers to many other questions.
We first learned about binary AST at this year’s TSConf when TypeScript creator Anders Hejlsberg was asked about converting TypeScript to WebAssembly. Anders expressed hope for improvements from binary AST.
The binary AST proposal is one of the most promising proposals to improve web performance speed in the past several years. Assuming this proposal progresses further, we expect to use it as soon as it is available as well as support it within Dojo once it is an option.
Need help? Let us know!
While it is too early to leverage binary AST within your applications, we work with many organizations to improve the architecture and performance of their web applications. If you need help improving the performance of your application, contact us to discuss how we can help!