unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: acm@muc.de, 52298@debbugs.gnu.org
Subject: bug#52298: 29.0.50; Frequent redisplay cycles induced by c-type-finder-timer-func timer in CC Mode
Date: Tue, 7 Dec 2021 19:58:39 +0000	[thread overview]
Message-ID: <Ya+875sYgG5CPVs2@ACM> (raw)
In-Reply-To: <83pmq8zi5b.fsf@gnu.org>

Hello, Eli.

On Tue, Dec 07, 2021 at 14:58:08 +0200, Eli Zaretskii wrote:
> > Date: Mon, 6 Dec 2021 20:53:15 +0000
> > Cc: bug-gnu-emacs@gnu.org
> > From: Alan Mackenzie <acm@muc.de>

> > > 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?

I think there's still a bug in the mechanism.  This mechanism was the
outcome of a long thread in the list a few months ago, complaining about
the perceived randomness of CC Mode's font locking.  It scans all CC
Mode buffers at startup, and each buffer which gets visited, to detect
"found types".  For each occurrence anywhere in the buffer of a newly
"found type", the fontified text property gets set to nil.  Further, if
this occurrence is in a currently displayed window, a redisplay gets
triggered.

In a (hopefully fixed) bug, there occurred constant redisplay, because
the newly found types weren't getting properly added to
c-found-type-list.  The same thing might still be happening in a
different way.

> > 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.

Is that with xdisp.c the only CC Mode buffer?  When my desktop had
around 700 buffers, many of them CC Mode, the total background
processing was of the order of 10 minutes (optimised build).

That 4 minutes 21 seconds - does the thrashing of the redisplay stop
after this amount of uptime?

As a matter of interest, is Emacs responsive to key strokes when this is
happening?

> > 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?

What changes in the buffer is the detection of "foo", "bar", ... as
found types.  These get marked throughout the buffer with the fontified
text property set to nil, and if an occurrence is in a displayed window,
that triggers an immediate redisplay to refontify that visible
occurrence of the found type.  I think this repeated redisplay is
happening too often.

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2021-12-07 19:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-05  7:46 bug#52298: 29.0.50; Frequent redisplay cycles induced by c-type-finder-timer-func timer in CC Mode Eli Zaretskii
2021-12-06 20:53 ` Alan Mackenzie
2021-12-07 12:58   ` Eli Zaretskii
2021-12-07 19:58     ` Alan Mackenzie [this message]
2021-12-07 20:16       ` Eli Zaretskii
2021-12-08 20:15 ` Alan Mackenzie
2021-12-09  7:08   ` Eli Zaretskii
2021-12-09 20:11     ` Alan Mackenzie
2021-12-09 20:38       ` Eli Zaretskii
2021-12-10 18:16         ` Alan Mackenzie
2021-12-10 18:51           ` Eli Zaretskii
2021-12-10 22:52             ` Alan Mackenzie
2021-12-11  7:59               ` Eli Zaretskii
2021-12-11 14:52                 ` Alan Mackenzie
2021-12-11 15:38                   ` Eli Zaretskii
2021-12-11 17:04                     ` Alan Mackenzie
2021-12-11 18:21                       ` Eli Zaretskii
2021-12-12  8:58                         ` Alan Mackenzie
2021-12-12  9:15                           ` Eli Zaretskii
2021-12-12 19:05                             ` Alan Mackenzie
2021-12-12 19:21                               ` Eli Zaretskii
2021-12-13 14:19                                 ` Alan Mackenzie
2021-12-12 23:31                               ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-13 14:25                                 ` Alan Mackenzie
2021-12-19 14:38                               ` Alan Mackenzie

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=Ya+875sYgG5CPVs2@ACM \
    --to=acm@muc.de \
    --cc=52298@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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).