tree-sitter.tree-sitter/lib
Will Lillis b0ddae770e perf(query): use min-heap for finished_states in next_capture
`ts_query_cursor_next_capture` linearly scanned all finished states to
find the one with the earliest next capture byte offset. With deeply
nested code, this O(n) scan per capture caused the highlight crate to
hang for minutes on large files.

Replace the linear scan with a min-heap over the finished_states array,
keyed by (next_capture_byte_offset, pattern_index, id). The heap is
maintained lazily: ts_query_cursor__advance uses plain array_push
(preserving FIFO insertion order), and next_capture sifts new elements
into the heap on entry via a tracked heap_size boundary. This preserves
the documented "order found" guarantee for next_match while giving
next_capture O(log n) per call.

(cherry picked from commit 123fb1c13c)
2026-04-27 03:37:38 -04:00
..
binding_rust fix(rust): fix new clippy lints 2026-04-23 02:19:20 -04:00
binding_web release v0.26.8 2026-03-31 19:31:10 +02:00
include/tree_sitter fix(lib): document invariants that must be upheld for TSInputEdit 2026-03-23 00:16:34 -04:00
lldb_pretty_printers feat(lib): add lldb pretty-printers for some C lib types 2025-08-22 20:10:03 -04:00
src perf(query): use min-heap for finished_states in next_capture 2026-04-27 03:37:38 -04:00
.ccls rust: Change QueryCursor::captures to expose the full match 2019-10-03 12:45:58 -07:00
Cargo.toml build(deps): bump wasmtime-c-api to v36.0.7 2026-04-10 09:46:43 +02:00
LICENSE chore: copy license to all packages 2025-09-11 03:12:35 -04:00
package.nix build(cmake)!: move CMakeLists.txt to the source root 2025-09-11 01:59:37 -04:00
README.md docs: update badges; fix markdown lint complains 2023-04-16 23:39:08 +03:00
tree-sitter.pc.in build(lib): build using cmake 2024-09-07 18:38:05 -04:00

Subdirectories

  • src - C source code for the Tree-sitter library
  • include - C headers for the Tree-sitter library
  • binding_rust - Rust bindings to the Tree-sitter library
  • binding_web - JavaScript bindings to the Tree-sitter library, using WebAssembly