tree-sitter.tree-sitter/crates
Will Lillis ec0f2b59ee perf(generate): use bitsets for coincident tokens and TokenConflictMap
- replace `Vec<Vec<ParseStateId>>` with a flat bitset in
  `CoincidentTokenIndex` for membership queries

The previous representation stored full lists of parse state IDs for
each token pair. Since only membership (yes/no) is needed for most
queries, a flat bitset (`Vec<u64>` indexed as `a * n + b`) is
better. Both `(a,b)` and `(b,a)` bits are set during construction
so `contains()` needs no min/max normalization. The original
`entries: Vec<Vec<ParseStateId>>` and `states_with()` method are
retained alongside the bitset, because `identify_keywords` needs
to iterate over the specific parse states where two tokens co-occur
rather than scanning all states. ~8% walltime reduction for
tree-sitter-bash.

- add word-aligned per-row bitsets to `CoincidentTokenIndex` for
  vectorized intersection checks

Row `a` spans `[a * row_words .. (a+1) * row_words]` where
`row_words = n.div_ceil(64)`. This enables callers in
`build_lex_table` to perform word-level AND operations against
`TokenSet::terminal_bits_words()` instead of iterating individual
token indices. ~6% walltime reduction on tree-sitter-bash.

- add `TokenSet::terminal_bits_words()` accessor and `#[inline]` on
  `BitVec::insert_all`

Expose the raw `&[u64]` backing the terminal bitset so callers can
perform word-level bitwise intersection. Mark `insert_all` as
`#[inline]` to allow the compiler to optimize the hot OR loop.
2026-04-04 17:58:29 -04:00
..
cli fix(test): split up cli testing test 2026-03-31 04:00:43 -04:00
config treewide: add taplo config and reformat toml files 2026-02-18 00:59:34 -05:00
generate perf(generate): use bitsets for coincident tokens and TokenConflictMap 2026-04-04 17:58:29 -04:00
highlight fix(rust): correct various typos 2026-03-28 05:23:10 -04:00
language treewide: add taplo config and reformat toml files 2026-02-18 00:59:34 -05:00
loader build(deps): bump binaryen to v129 2026-04-04 21:32:49 +02:00
tags treewide: add taplo config and reformat toml files 2026-02-18 00:59:34 -05:00
xtask fix(rust): correct various typos 2026-03-28 05:23:10 -04:00