Subject: Re: bug#25706: 26.0.50; Slow C file fontification

From: Ravine Var <[email-masked]>
Date: Thu, 10 Dec 2020 22:32:17 +0530

> Thank you indeed for taking the trouble to test the patch on the lesser
> machine.  I do not have access to such a machine.  I am assuming that
> before this patch, such a large file like osprey_reg....h would have
> been completely unworkable on the machine.  It sounds as though it still
> is.  However, have you noticed any improvement at all in performance?

There is a marginal improvement - recovery from scroll lockups are
slightly faster. But, in general, working with the osprey header
file is still very painful.

> Could I ask you please to do one more thing, and that is to take a
> profile on this machine where it is giving trouble.  From a freshly
> loaded buffer, move forward (if necessary) to a troublesome spot.  N.B.
> C-u 1 M-> moves to 10% away from the end of the buffer, C-u 2 M-> 20%,
> and so on.  Then start the profiler and do what is causing sluggish
> performance.  Then have a look at the final profiler output, and expand
> it sensibly so that the troublesome function can be found.
>
> (Optional paragraph.)  How to use the profiler: Do M-x profiler-start
> RET, and accept the default mode with another RET.  Perform the stuff to
> be profiled.  Do M-x profiler-report, which gives three or four lines of
> output, each with a number and a percentage.  Move point to a line with
> a large percentage and type RET to expand it.  You can repeat this to
> expand further.  Please expand the lines down to where the percentages
> remaining are around 5% or 6%.  There will be quite a lot of lines near
> the start showing the same large percentage.

I opened the osprey file and started scrolling down and the screen
locked up. Here is the profile report (with emacs -Q):

https://gist.github.com/ravine-var/0c293968a902cde76af77f2872dde1d7

I am using emacs master (along with your patch) built with LTO enabled
and CFLAGS set to '-O2 -march=native'.