bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#60953: The :match predicate with large regexp in tree-sitter font-lo


From: Dmitry Gutov
Subject: bug#60953: The :match predicate with large regexp in tree-sitter font-lock seems inefficient
Date: Thu, 26 Jan 2023 22:46:30 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 26/01/2023 20:07, Dmitry Gutov wrote:
One could hope to avoid recreating the list of predicates on every match, but that seems to be a limitation of the TS API: ts_query_predicates_for_pattern requires a second argument, match.pattern_index. Maybe we could memoize that, though?

Speaking of memoization, here is a POC patch.

It's a definite improvement: with the attached :match almost reaches the performance of :pred. Not sure why it's still not faster, though.

(I also tried a more comprehensive memoization using a hash table, the resulting performance was slightly worse.)

Attachment: memoize_simple.diff
Description: Text Data


reply via email to

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