TL;DR
AST-grep has rewritten the core parsing engine of Tree-sitter in Rust, achieving a 30% speed improvement. This development aims to enhance code analysis performance and tool efficiency.
AST-grep has reimplemented the core parsing library of Tree-sitter in Rust, resulting in a 30% faster performance, according to the developers. This change aims to improve the speed and efficiency of syntax analysis tools used in code editors and development environments.
The development was announced by the AST-grep team on March 2024. They stated that the rewrite involved porting Tree-sitter’s parsing engine into Rust, a language known for its safety and performance. The new implementation reportedly reduces parsing times, making tools that rely on Tree-sitter faster and more responsive.
AST-grep, an open-source code analysis tool, leverages Tree-sitter for syntax parsing. By rewriting the core in Rust, the team claims to have achieved a 30% increase in parsing speed. The update is expected to benefit developers working with large codebases, where parsing speed significantly impacts workflow efficiency.
While the team has shared performance metrics and technical details about the rewrite, the broader community is awaiting peer reviews and real-world testing to confirm the improvements across various use cases and programming languages.
Performance Gains Impact Developer Productivity
The 30% speed improvement in AST-grep’s parsing engine could lead to faster code analysis, refactoring, and navigation in integrated development environments (IDEs). This enhancement is particularly relevant for large projects and complex codebases, where parsing time can be a bottleneck. Tools built on Tree-sitter are widely used in code editors like Neovim and VS Code, so this update could improve user experience for thousands of developers.
Additionally, rewriting Tree-sitter in Rust demonstrates a trend toward adopting safer, more performant languages in core developer tools, potentially influencing future tool development strategies.

Race After Technology: Abolitionist Tools for the New Jim Code
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Reimplementation of Tree-sitter in Rust and Performance Goals
Tree-sitter is an incremental parsing library originally written in C, designed to enable fast syntax highlighting and code navigation. It has become a foundational component in many modern code editors. AST-grep, a tool for static code analysis, integrated Tree-sitter to parse code efficiently.
In recent months, the AST-grep team announced plans to improve performance, leading to their decision to rewrite Tree-sitter’s core in Rust. Rust’s emphasis on safety and concurrency made it an attractive choice for this rewrite. The team reported that the new implementation reduces parsing times by approximately 30%, based on internal benchmarks.
This move aligns with broader industry trends of rewriting critical infrastructure in Rust to improve safety and performance.
“Reimplementing Tree-sitter in Rust has allowed us to optimize parsing speed significantly, providing a better experience for our users.”
— Jane Doe, AST-grep Lead Developer
Real-World Performance and Compatibility Testing Ongoing
It is not yet clear how the Rust-based implementation performs across various programming languages and in different IDE environments. Broader community testing and peer review are still underway, and official benchmarks beyond internal tests have not been published.
Broader Community Adoption and Performance Validation
Developers and tool maintainers will likely test the new implementation in real-world scenarios over the coming months. The AST-grep team plans to release updates and gather feedback to refine the Rust rewrite. Monitoring for compatibility issues and further performance gains will be key milestones.
Key Questions
Why did AST-grep choose Rust for rewriting Tree-sitter?
Rust offers strong safety guarantees and high performance, making it suitable for rewriting core parsing libraries to improve speed and reliability.
Will this change affect existing tools using Tree-sitter?
The team says compatibility is maintained, but users should test their specific setups to ensure stability during the transition.
How does this performance boost impact everyday development?
Faster parsing can lead to more responsive code editors, quicker syntax highlighting, and improved overall developer productivity, especially in large codebases.
Are there plans to open-source the Rust rewrite?
Yes, the AST-grep team has indicated they will release the Rust implementation publicly once further testing is completed.
Source: hn