From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: casouri@gmail.com, 60953@debbugs.gnu.org
Subject: bug#60953: The :match predicate with large regexp in tree-sitter font-lock seems inefficient
Date: Mon, 30 Jan 2023 20:42:34 +0200 [thread overview]
Message-ID: <83wn533lut.fsf@gnu.org> (raw)
In-Reply-To: <33cad4c1-4af5-37bb-05bc-79a4d9c1a700@yandex.ru> (message from Dmitry Gutov on Mon, 30 Jan 2023 20:20:46 +0200)
> Date: Mon, 30 Jan 2023 20:20:46 +0200
> Cc: casouri@gmail.com, 60953@debbugs.gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
>
> On 30/01/2023 19:49, Eli Zaretskii wrote:
> >> Date: Mon, 30 Jan 2023 19:15:07 +0200
> >> Cc: casouri@gmail.com, 60953@debbugs.gnu.org
> >> From: Dmitry Gutov <dgutov@yandex.ru>
> >>
> >>> fast_looking_at already does an anchored match, so I'm not sure I
> >>> follow. I don't even understand why you need th \` part, when the
> >>> match will either always start from the first position or fail.
> >>
> >> The regexp might include the anchors, or it might not.
> >>
> >> It might also use a different anchor like ^ or $ or \b.
> >
> > OK, but it always goes only forward, so narrowing to the beginning
> > shouldn't be necessary. Right?
>
> Are you saying that fast_looking_at ("\\`", ...) will always succeed?
>
> And fast_looking_at ("^", ...), etc.
For example, for "^", if you hint that it must look back to make sure
there's a newline there, then your narrowing will also prevent it from
doing that, right?
> >> One possible alternative, I suppose, would be to create a raw pointer to
> >> a part of the buffer text and call re_search directly specifying the
> >> known length of the node in bytes. If buffer text is one contiguous
> >> region in memory, that is.
> >
> > It isn't, though: there's the gap. Which is why doing this is not
> > recommended; instead, use something like search_buffer_re, which
> > already handles this complication for you. (Except that
> > search_buffer_re is a static function, so only code in search.c can
> > use it. So you'd need to make it non-static.)
>
> Interesting. Does search_buffer_re match the \` anchor at POS and \' at
> LIM? IOW, does in treat the rest of the buffer as non-existing? Or could it?
That is the low-level subroutine called by re-search-forward, so you
know the answers already, I think? IOW, that function behaves exactly
like re-search-forward in those situations.
next prev parent reply other threads:[~2023-01-30 18:42 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 3:53 bug#60953: The :match predicate with large regexp in tree-sitter font-lock seems inefficient Dmitry Gutov
2023-01-24 4:04 ` Dmitry Gutov
2023-01-25 3:13 ` Yuan Fu
2023-01-25 3:48 ` Dmitry Gutov
2023-01-25 12:49 ` Eli Zaretskii
2023-01-25 23:21 ` Dmitry Gutov
2023-01-26 6:50 ` Eli Zaretskii
2023-01-26 7:17 ` Yuan Fu
2023-01-26 8:10 ` Eli Zaretskii
2023-01-26 17:15 ` Dmitry Gutov
2023-01-26 18:24 ` Eli Zaretskii
2023-01-26 19:35 ` Dmitry Gutov
2023-01-26 20:01 ` Eli Zaretskii
2023-01-26 21:26 ` Dmitry Gutov
2023-01-30 0:49 ` Dmitry Gutov
2023-01-30 14:06 ` Eli Zaretskii
2023-01-30 14:47 ` Dmitry Gutov
2023-01-30 15:08 ` Eli Zaretskii
2023-01-30 17:15 ` Dmitry Gutov
2023-01-30 17:49 ` Eli Zaretskii
2023-01-30 18:20 ` Dmitry Gutov
2023-01-30 18:42 ` Eli Zaretskii [this message]
2023-01-30 19:01 ` Dmitry Gutov
2023-01-30 19:05 ` Eli Zaretskii
2023-01-30 19:58 ` Dmitry Gutov
2023-01-30 23:57 ` Yuan Fu
2023-01-31 0:44 ` Dmitry Gutov
2023-01-31 3:23 ` Eli Zaretskii
2023-01-31 18:16 ` Dmitry Gutov
2023-02-01 2:39 ` Dmitry Gutov
2023-02-01 13:39 ` Eli Zaretskii
2023-02-01 15:13 ` Dmitry Gutov
2023-02-01 21:20 ` Dmitry Gutov
2023-02-02 2:16 ` Yuan Fu
2023-02-02 6:34 ` Eli Zaretskii
2023-02-02 12:12 ` Dmitry Gutov
2023-02-02 14:23 ` Eli Zaretskii
2023-02-02 17:03 ` Dmitry Gutov
2023-02-02 17:26 ` Eli Zaretskii
2023-02-02 17:53 ` Dmitry Gutov
2023-02-02 18:03 ` Eli Zaretskii
2023-02-02 19:44 ` Dmitry Gutov
2023-02-01 13:10 ` Eli Zaretskii
2023-02-01 15:15 ` Dmitry Gutov
2023-01-26 17:12 ` Dmitry Gutov
2023-01-26 18:07 ` Dmitry Gutov
2023-01-26 20:46 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83wn533lut.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=60953@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=dgutov@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).