Subject: Re: bug#15011: 24.3; Scrolling Performance

From: Stefan Monnier <[email-masked]>
Date: Sun, 04 Aug 2013 17:32:15 -0400

> I think the best behaviour on auto-repeat scrolling in slow fontifying
> modes would be for the text to scroll by unfontified until the
> <page-down> key is released, the final window contents then being
> fontified.  I've not managed to configure the current jit-lock to
> achieve this behaviour.  Is this possible?

Setting jit-lock-defer-time to (/ 1.0 repeat-rate) should get you
fairly close.

> `jit-lock-function' could then be modified to calculate how many buffer
> positions it is going to be expected to fontify, and whether it can
> achieve this before the putative next auto-repeat scroll command
> arrives.

We could refine jit-lock-defer in such a way, indeed.  I guess we could
do something like set jit-lock-defer-time to a very low value (like 0s)
and then each time we get a request for N bytes of fontification, we
postpone running the timer by some additional increment (until reaching
some maximum).

Of course, this assumes that the time to fontify is proportional to the
text to fontify, which is not necessarily the case (in many case,
a significant part of slowdown is a need to scan a large amount of text
before point to determine the syntax at a particular position in the
buffer, so just fontifying this particular position will require a lot
of time).

Note also that the OP mentioned:

> Once you have scrolled to the bottom of the file Page Down will work
> reasonably, however page up remains slow.

Which seems to indicate that page-up scrolling is too slow even
when font/jit-lock is not called any more.

        Stefan