Skip to content

v0.40.0

Choose a tag to compare

@odvcencio odvcencio released this 17 Jul 22:47
1935a42

A byte-identical performance release, plus a security guard and an incremental-correctness fix. Every performance change is verified byte-for-byte identical to the C tree-sitter oracle across the 206-grammar parity suite.

Performance

On the forest-path grammars (C#, Bash, CMake) these compound to roughly a 30% wall-clock reduction with ~95% less allocation:

  • Build-time PGO — ~7% wall-clock, broad across all 206 grammars.
  • Forest-index allocation overhaul — the forest alternative index is pooled across parses and per-compare throwaway slices are gone; allocation bytes drop 86–96% and GC-cycle CPU 48–90%.
  • GLR comparator copy elimination — the disambiguation comparator chain takes stack pointers instead of copying a 104-byte value per call (~12 fewer runtime.duffcopy per compare); ~14% wall-clock.
  • Forest reducer pooling — the per-parse forest reducer is pooled; a further ~51% cut in C# parse allocation.

Security

  • Query matcher work budget — the -All quantifier matchers now charge a per-execution work budget, bounding worst-case combinatorial blow-up on adversarial query/source pairs. Surfaced via Cursor.DidExceedMatchLimit, configurable with SetMatchWorkBudget (default 1,000,000).

Fixed

  • Incremental reuse token-boundary bug — incremental parsing no longer reuses a stale subtree when an edit shifts a token boundary that abuts a reused node's right edge. Both the leaf and the non-leaf (wrapped-token) reuse paths now reject reuse on a boundary mismatch, preventing spurious ERROR nodes on common edits such as deleting the whitespace between two identifiers (e.g. Clojure (a b)(ab)). Verified byte-identical to a fresh parse across the C-oracle incremental parity harness.

Known issues (pre-existing, not regressions)

  • Incremental-forest divergence on javascript/jquery.js under the non-default GTS_FOREST_INCR=1 mode.
  • A single-character mid-identifier incremental-delete divergence class on some grammars (JS/TS/TSX/Python), unrelated to the boundary fix; tracked as follow-up.

The v0.39.0 authenticated cross-suite receipt remains the published performance baseline; a re-measured v0.40.0 receipt is pending.

Full changelog: v0.39.0...v0.40.0