|
From: | Dmitry Gutov |
Subject: | bug#60953: The :match predicate with large regexp in tree-sitter font-lock seems inefficient |
Date: | Wed, 1 Feb 2023 17:15:43 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 |
On 01/02/2023 15:10, Eli Zaretskii wrote:
Date: Tue, 31 Jan 2023 20:16:01 +0200 Cc: casouri@gmail.com, 60953@debbugs.gnu.org From: Dmitry Gutov <dgutov@yandex.ru>Can you describe what that function should do? I don't think I have a clear idea of that.In Lisp that function could be implemented as (defun buffer-substring-match (regexp &optional start end inhibit-modify) (string-match regexp (buffer-substring (or start (point-min)) (or end (point-max))) inhibit-modify)) Meaning, it matches the regexp against the buffer substring, with the string-start and string-end anchors working. But it would be implemented in C, meaning we could avoid the extra consing and funcall overhead.Now I'm confused, because I thought the C functions we were considering all fit the above description.
Except they don't match \` and \' at START and END. Only at actual point-min and point-max.
I suppose the new function could be implemented with narrowing as well. If we decide it's the best method.
Anyway, it seems like it might be too late as an addition to Emacs 29. And we can implement the match predicate using narrowing for this release, to be updated later.Right, this is not a catastrophe, IMO. The work on TS-based modes is just beginning.
I also don't see any particular slowdown from altering BEGV and ZV in C. So the current method might be the fastest possible anyway.
[Prev in Thread] | Current Thread | [Next in Thread] |