tree-sitter.tree-sitter/crates
Will Lillis fad0a62a35 perf(generate): pool parse-table action lists
Every (state, terminal) parse-table entry stored its action list inline as a
32-byte `ParseTableEntry`, but across a grammar those lists are ~98-99% _duplicates_.
The number of distinct lists is a few thousand regardless of grammar size, while
total entries scale into the hundreds of thousands.

Store each unique action list once in a shared `ActionListPool` (a flat arena of
actions plus `(offset, len)` ranges) and replace the inline entry with a 4-byte
`ActionListId` (a pool index with the `reusable` flag packed into the high bit).

- intern_table converts the freshly built `ParseTable<ParseTableEntry>` into
  `ParseTable<ActionListId>`.
- minimize carries and operates on the 4-byte ids. The three global state
  renumberings rewrite Shift targets once at the pool level
  (`remap_terminal_references`), while the per-state unit-reduction redirects
  copy the changed list into a new slot (COW). `mark_fragile_tokens` becomes a
  free bit flip on the id.
- `canonicalize` dedups and compacts the pool once before `render`, dropping the
  dead and duplicate slots the remaps and COW leave behind. `render` assigns the
  output action-list offsets directly.

Yields ~7% wall time reduction, ~12% peak rss reduction.
2026-08-09 12:28:50 -05:00
..
cli fix(lib): continue search for later named siblings in 2026-08-07 17:54:36 -04:00
config fix(rust): use more accurate types for various IoError structs 2026-06-13 09:35:12 -04:00
generate perf(generate): pool parse-table action lists 2026-08-09 12:28:50 -05:00
highlight feat(highlight)!: include underlying LanguageError in highlight 2026-07-14 19:19:49 -04:00
language treewide: add taplo config and reformat toml files 2026-02-18 00:59:34 -05:00
loader fix(highlight): use std::sync::OnceCell for various loader fields 2026-07-23 18:30:15 -04:00
tags feat(tags)!: include underlying LanguageError in tag 2026-07-14 19:19:49 -04:00
xtask fix(xtask): eliminate silent errors in zig fetch 2026-06-30 19:37:55 -04:00