GNU TeXmacsUser manualReferenceAboutEnglish
Pitfalls of tree-sitter

The pitfalls which concern all the features of program code (builds without a feature, providers, folds, layers) are in the pitfalls of the features of program code. Those below are particular to tree-sitter.

1.Positions and encodings

2.Regions and lines

3.Highlighters which come late

4.Tables and caches

5.Scheme of the generator and the scanners

6.Orders of magnitude

Measured on an Apple M-series machine and recorded in

src/docs/tree-sitter.md

: generating the tables takes 0.2 s for Scheme, 0.5 s for Python, 0.7 s for C and 6.5 s for C++ under S7 in TeXmacs, and Lean about a minute and gigabytes, hence the shipped tables (unpacked in about 0.1 s). A file of 100 KB of Python parses in about 40 ms; a scanner called at nearly every token costs more (254 KB of Bash in about 0.3 s). Typing in a C++ file of 13000 lines costs about 6 ms per edit, most of it the incremental parse, since only the lines out of date are coloured again.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".