Subject: Re: bug#52298: 29.0.50; Frequent redisplay cycles induced by c-type-finder-timer-func timer in CC Mode

From: Eli Zaretskii <[email-masked]>
Date: Tue, 07 Dec 2021 14:58:08 +0200

> Date: Mon, 6 Dec 2021 20:53:15 +0000
> Cc: [email-masked]
> From: Alan Mackenzie <[email-masked]>
> 
> > This is no longer the case in Emacs 29.  There, if you visit a C file,
> > you will see a flurry of stderr messages about constant redisplay
> > cycles being forced.  It seems like the culprit is the function
> > 'c-type-finder-timer-func', which is run from a timer at 10 Hz (!),
> 
> That is customisable with c-type-finder-repeat-time.  The idea is to
> have this as often as possible so that the backgroud scanning is
> complete as soon as possible.  (See my next paragraph.)

Yes, but why would I need to do one more chore to get me a "silent"
redisplay?  And why does this timer cause such a serious work to the
display engine?

> If this processing continues beyond the time to scan all CC Mode
> buffers, then there is a bug.  A megabyte long file (xdisp.c) scans in
> aroung 18 seconds on my machine.

18 seconds is almost an eternity for my frequent use cases of firing
up Emacs to debug some display problem.  And it's much more than 18
sec here: I measured 4 minutes and 21 sec, with 1:54 CPU time.  My
build is unoptimized, but still, a factor of 13 wrt your timing is too
much to be explained by that alone.

> It can be disabled by setting (or customising) c-type-finder-time-slot
> to nil.  As I say, the activity should cease after a few seconds, or a
> few minutes with a well filled desktop.

Once again, it takes much more here.  And my main question was left
unanswered: what does this timer function do to cause such thorough
redisplay cycles, when I know that nothing was changed in the buffer?
can you please describe what this function does that could have such
an effect?