Subject: Re: bug#58558: 29.0.50; re-search-forward is slow in some buffers

From: Eli Zaretskii <[email-masked]>
Date: Mon, 10 Apr 2023 16:40:51 +0300

> From: Ihor Radchenko <[email-masked]>
> Cc: [email-masked], [email-masked], [email-masked]
> Date: Mon, 10 Apr 2023 12:24:23 +0000
> 
> >> 43.82%--Fre_search_forward
> >>  --43.81%--search_command
> >>   --43.78%--search_buffer
> >>    --43.78%--search_buffer_re
> >>     --43.33%--re_search_2
> >>      --36.39%--re_match_2_internal
> >>       --21.90%--SYNTAX_TABLE_BYTE_TO_CHAR
> >>        --21.57%--BYTE_TO_CHAR
> >>         --21.49%--buf_bytepos_to_charpos
> >> 
> >> Not sure if it is telling much.
> >
> > How does this compare with a "fast" session doing the same?
> 
> "fast" (emacs 28) session does not have this call tree contributing
> significantly.

Hmm... I though when you just start a new Emacs session of Emacs 30 it
also is fast, and becomes progressively slower with time?  Or am I
confused?

> re_match_2_internal calls SYNTAX_TABLE_BYTE_TO_CHAR in a loop. So, if
> something strange is happening with the loop, we may be calling
> buf_bytepos_to_charpos more.

I believe perf is capable of showing the number of calls as well?  Can
you compare the number of calls between the two versions?