unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Alan Mackenzie <acm@muc.de>
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: Sat, 11 Dec 2021 17:38:34 +0200	[thread overview]
Message-ID: <83zgp7p2x1.fsf@gnu.org> (raw)
In-Reply-To: <YbS7JkE/o+7/ncyp@ACM> (message from Alan Mackenzie on Sat, 11 Dec 2021 14:52:22 +0000)

> Date: Sat, 11 Dec 2021 14:52:22 +0000
> Cc: 52298@debbugs.gnu.org, acm@muc.de
> From: Alan Mackenzie <acm@muc.de>
> 
> c-is-sws (along with c-in-sws) marks syntactic whitespace in a buffer so
> that especially for long comments, passing over that WS is rapid (after
> the first pass has marked the properties).
> 
> c-type marks certain types of identifiers and positions related to a CC
> Mode declaration, e.g. the start of a declarator, or the end of the
> previous statement.
> 
> > Could we perhaps refrain from putting them on buffer text when those
> > functions are called from the timer?
> 
> That would not be sensible.  Both of them are for optimisation, and
> preventing them being used from the timer would involve an involved
> (slow) mechanism.

But we are talking about the timer whose job is to find type
declarations.  Does that job require these properties?

> OK, I think I see what the problem is, now.  It's the middle line in ....
> 
>   redisplay_internal 0
>   071a03c8 (xdisp.c): try_window_id 2
>   redisplay_preserve_echo_area (8)
> 
> ..... , which indicates deep processing in redisplay.  (Yes, I know you've
> been telling me this for a while...)  The question is why does the code
> get that deep in rather than being aborted earlier?

I already established that, it's the fact that the buffer's modified
tick is increasing.  This then causes this test:

  current_matrix_up_to_date_p
    = (w->window_end_valid
       && !current_buffer->clip_changed
       && !current_buffer->prevent_redisplay_optimizations_p
       && !window_outdated (w)
       && !hscrolling_current_line_p (w));

to fail because window_outdated returns non-zero.  That's how I knew
that the buffer's modified tick is the culprit.

> Another thing.  After waiting the ~2 minutes for the background scanning
> to complete, I had a look at which character positions had the
> `fontified' text property, using a simple utility I wrote some years ago:
> [...]
> Using the [f10] key (or just typing M-x get-fontified, if F10 is
> otherwise occupied) the following positions ended up fontified in
> X-Windows after that 2 minute pause:
> 
>     "Fontified regions: ((1 . 1740))"
> 
> ,  That is, at the end, only the visible portion and a bit more were
> fontified.  This suggests (though not conclusively) that no fontification
> happened anywhere else in the buffer.

So why is the timer function keep running for so long, and why does it
put those two other properties on the rest of the buffer?  It sounds
to me like you could stop the timer once the visible portion of the
buffer has been reached, because no type after that can affect
fontification.  You could then restart the timer when the buffer is
modified, or if the window is scrolled to reveal a portion of the
buffer below the current end-of-window.





  reply	other threads:[~2021-12-11 15:38 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
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 [this message]
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=83zgp7p2x1.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=52298@debbugs.gnu.org \
    --cc=acm@muc.de \
    /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).