emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tree-sitter integration on feature/tree-sitter


From: Yoav Marco
Subject: Re: Tree-sitter integration on feature/tree-sitter
Date: Wed, 11 May 2022 14:16:03 +0300
User-agent: mu4e 1.6.3; emacs 29.0.50

> I admit that I don't have a clear idea of the issues that bother you.
> Can you post a summary?

Tree sitter parsers make a parse tree. To extract syntax highlighting
from the tree you run a query that matches tree structures returns
annotated nodes.

Queries need to be compiled to run them. Right now queries are kept as
elisp strings and compiled each time we want to run them.

Compiling on each run is fine if we run the query extracting syntax
highlighting information once, but to highlight a buffer in parts
on-demand means running (thus compiling) the query every time on
different ranges. When editing buffer the query is re-run on each change
too.

I made a benchmark that tested whether reusing the compiled query would
make anything faster, and turns out it's the biggest bottleneck in
treesit-font-lock-fontify-region.

The question right now is how to reuse queries. We could make a cache
like the one for compiled regexps in search.c, or
> On May 10, 2022, at 23:53 UTC, Yuan Fu <casouri@gmail.com> wrote:
>
> just expose query object, and let user store them in lisp. Is there
> any downsides of exposing another type to lisp? Currently tree-sitter
> adds two new types: treesit-node and treesit-parser.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]