How AST-grep Rewrote Tree-sitter in Rust and Made It 30% Faster

astgrep.com
July 26, 2026
16 min read
49/100
Summary
ast-grep rewrote Tree-sitter's C core in Rust, resulting in a 30% increase in parser speed and a 22% improvement in overall performance for ast-grep. The new core enhances parsing efficiency and accelerates tree reading.
Key Takeaways
- ast-grep rewrote Tree-sitter's C core in Rust, achieving a 30% increase in parsing speed and a 22% overall performance improvement for ast-grep.
- The Rust implementation outperformed the original C version in all parsing and traversal benchmarks, with a throughput increase of up to 29.74%.
- The new Rust core uses approximately 8 MiB more memory during ast-grep runs compared to the C version, peaking at 91.2 MiB on large datasets.
- The rewritten Tree-sitter maintains compatibility with existing generated languages and parsers while removing unnecessary editor-specific features.
Coverage & discussions
Hacker News · astgrep.com
Community discussions
Community Sentiment
Positives
- Implementing incremental parsing improved performance from 5ms to 400us for small edits, showcasing tree-sitter's potential in real-world applications.
- The ability to easily distribute grammars through package managers is a game-changer for expanding ast-grep's capabilities.
Concerns
- The removal of incremental old-tree reuse raises concerns that performance gains are achieved at the expense of practical usability in common scenarios.
- Many commenters find the AI-generated nature of the article disappointing, questioning the authenticity and value of the content.
Related Articles

I rewrote PostHog's SQL parser, 70x faster, while barely looking at the code
Jun 24, 2026

Bun has been converted to rust. Now what?
Jun 3, 2026

Untapped Way to Learn a Codebase: Build a Visualizer
Feb 20, 2026

I built a Game Boy emulator in F#
Apr 30, 2026

Agent swarms and the new model economics
Jul 20, 2026