emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug-reference-prog-mode slows down CC Mode's scrolling by ~7%


From: Eli Zaretskii
Subject: Re: bug-reference-prog-mode slows down CC Mode's scrolling by ~7%
Date: Sat, 11 Sep 2021 15:49:48 +0300

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: acm@muc.de,  emacs-devel@gnu.org
> Date: Sat, 04 Sep 2021 14:40:16 -0400
> 
> > Do you have some Lisp to show that invisible text isn't fontified by
> > jit-lock?
> 
>     src/emacs -Q lisp/subr.el -f outline-minor-mode --eval '(hide-sublevels 
> 1)'
> 
> then go to the line that says "subr.el ends here" and do
> 
>     M-: (get-text-property (- (point) 10) 'fontified) RET
> 
> and it will probably say nil.

That's sheer luck: it happens only when the invisible text between
headings is longer than jit-lock-chunk-size.

What happens is this:

  . redisplay invokes jit-lock, which fontifies jit-lock-chunk-size
    characters;
  . redisplay discovers the invisible text, and skips to its end;
  . redisplay once again invokes jit-lock after skipping invisible
    text;

etc., etc., until we reach the end of the window (which in the above
case means EOB).

So what you get is 1500 characters after each heading fontified, the
rest not fontified.  E.g., try your get-text-property trick on
headings other than the last one.

> PS: My own config enables `outline-minor-mode` and calls
> `hide-sublevels` in a similar way, so I'd notice the performance
> difference if the whole buffer were fontified ;-)

If you hide a lot of text, then yes, only parts of it will be
fontified.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]