From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <83sfv74hpm.fsf@gnu.org> <83pmq8zi5b.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9410"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, 52298@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 07 20:59:13 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mugcL-0002IR-1L for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 07 Dec 2021 20:59:13 +0100 Original-Received: from localhost ([::1]:43772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mugcJ-0006fZ-Cb for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 07 Dec 2021 14:59:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mugcA-0006ce-AW for bug-gnu-emacs@gnu.org; Tue, 07 Dec 2021 14:59:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55380) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mugcA-000738-1B for bug-gnu-emacs@gnu.org; Tue, 07 Dec 2021 14:59:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mugc9-0001OX-RQ for bug-gnu-emacs@gnu.org; Tue, 07 Dec 2021 14:59:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Dec 2021 19:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52298 X-GNU-PR-Package: emacs Original-Received: via spool by 52298-submit@debbugs.gnu.org id=B52298.16389071355348 (code B ref 52298); Tue, 07 Dec 2021 19:59:01 +0000 Original-Received: (at 52298) by debbugs.gnu.org; 7 Dec 2021 19:58:55 +0000 Original-Received: from localhost ([127.0.0.1]:38693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mugc3-0001OC-7o for submit@debbugs.gnu.org; Tue, 07 Dec 2021 14:58:55 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:55603 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1mugby-0001Ns-0D for 52298@debbugs.gnu.org; Tue, 07 Dec 2021 14:58:54 -0500 Original-Received: (qmail 49274 invoked by uid 3782); 7 Dec 2021 19:58:40 -0000 Original-Received: from acm.muc.de (p4fe15c4e.dip0.t-ipconnect.de [79.225.92.78]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 07 Dec 2021 20:58:40 +0100 Original-Received: (qmail 8252 invoked by uid 1000); 7 Dec 2021 19:58:39 -0000 Content-Disposition: inline In-Reply-To: <83pmq8zi5b.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:221868 Archived-At: 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 > > > 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).