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

From: Eli Zaretskii <[email-masked]>
Date: Tue, 18 Oct 2022 21:38:39 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Tue, 18 Oct 2022 20:19:24 +0200
> 
> > What did you try?  It was quite simple, AFAIR, last time I tried.
> 
> I thought it might be easier to see the differences in results if one
> first attached perf to a fresh (fast) Emacs and got the trace, and the
> waited until Emacs got slow, and repeated the same thing under another
> trace.
> 
> perf is able to do this by:
> 
> perf record -p <PID> -g

I never tried that, always started Emacs under perf to begin with.

> and
> 
> perf report
> 
> then shows me stuff, but I don't even know what to look for when
> interpreting that.

I thought you wanted to compare two or more profiles taken at
different times?  Then looking at percentages of the same functions
could tell something.  Since the complaint is about regexp search, I
guess re_compile_pattern and re_match_2_internal and their subroutines
would be the immediate suspects.  Or maybe re-search-forward, which is
a couple of levels higher.