Profiling the `ts_query__analyze_patterns` function shows that it spends a lot of time copying items in its various state sets. These state sets are kept sorted, and the items are fairly large, so any time that we insert new entries near the front of the array, a lot of calls to memcpy must occur. In advance of more sophisticated rework, one easy win is to hide the large `AnalysisStateSet` objects behind pointers, so that the size of each item in the list goes from 68 to 8 bytes, and add an object pool to reuse allocations. This shows a significant performance improvement for grammars that have a lot of states in them. |
||
|---|---|---|
| .. | ||
| binding_rust | ||
| binding_web | ||
| include/tree_sitter | ||
| src | ||
| .ccls | ||
| Cargo.toml | ||
| README.md | ||
Subdirectories
src- C source code for the Tree-sitter libraryinclude- C headers for the Tree-sitter librarybinding_rust- Rust bindings to the Tree-sitter librarybinding_web- JavaScript bindings to the Tree-sitter library, using WebAssembly