mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-12 09:47:20 +08:00
ts_node_child(root, i) and ts_node_next_sibling() both call ts_node_child_with_descendant() internally, making sibling iteration O(N²) total on roots with many children (e.g. generated TypeScript .d.ts files or large Perl files with 5,000–50,000 top-level nodes). Replace with TSTreeCursor: ts_tree_cursor_goto_next_sibling() maintains traversal state across calls and is O(1) per step, reducing total complexity from O(N²) to O(N). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>