neovim/runtime/lua
vanaigr 4b02916334
perf(treesitter): use child_containing_descendant() in has-ancestor? (#28512)
Problem: `has-ancestor?` is O(n²) for the depth of the tree since it iterates over each of the node's ancestors (bottom-up), and each ancestor takes O(n) time.
This happens because tree-sitter's nodes don't store their parent nodes, and the tree is searched (top-down) each time a new parent is requested.

Solution: Make use of new `ts_node_child_containing_descendant()` in tree-sitter v0.22.6 (which is now the minimum required version) to rewrite the `has-ancestor?` predicate in C to become O(n).

For a sample file, decreases the time taken by `has-ancestor?` from 360ms to 6ms.
2024-05-16 16:57:58 +02:00
..
nvim fix(healthcheck): expand vimrc variable (#28379) 2024-04-17 14:31:13 +08:00
provider fix(checkhealth): error in node.js check #28348 2024-04-15 09:23:22 -07:00
vim perf(treesitter): use child_containing_descendant() in has-ancestor? (#28512) 2024-05-16 16:57:58 +02:00
_vim9script.lua refactor(lua): rename tbl_islist => islist 2024-04-21 17:08:07 +02:00
coxpcall.lua build(lua): vendor coxpcall 2023-09-10 11:43:37 +02:00
editorconfig.lua docs: misc (#28609) 2024-05-15 07:18:33 +08:00
man.lua fix(man.vim): q quits after jump to different tag in MANPAGER modified (#28495) 2024-04-26 13:14:45 -05:00
tohtml.lua feat(lua): deprecate vim.tbl_add_reverse_lookup 2024-03-07 10:24:34 +01:00