1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00
emacs/admin/notes/tree-sitter/performance
2024-07-18 11:46:50 +02:00

26 lines
1020 B
Org Mode
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

TREE-SITTER PERFORMANCE NOTES -*- org -*-
* Facts
Incremental parsing of a few characters worth of edit usually takes
less than 0.1ms. If it takes longer than that, something is wrong.
Theres one time where I found tree-sitter-c takes ~30ms to
incremental parse. Updating to the latest version of tree-sitter-c
solves it, so I didnt investigate further.
The ranges set for a parser doesnt grow when you insert text into a
range, so you have to update the ranges every time before
parsing. Fortunately, changing ranges doesnt invalidate incremental
parsing, so there isnt any performance lost in update ranges
frequently.
* Experiments
Using regexp by default in treesit-simple-indent-rules seems wasteful,
so I tried replacing all string-match-p to equal in
treesit-simple-indent-presets, and indent xdisp.c for a comparison.
Turns out using regexp by default is faster: regexp-based indent took
45s and equal-based indent took 75s.
I could be missing something, further experiments are welcome.