Subject: Re: bug#34710: the mode line flicks on set-window-vscroll

From: Robert Pluim <[email-masked]>
Date: Mon, 04 Mar 2019 22:07:25 +0100

Alan Third <[email-masked]> writes:

> On Mon, Mar 04, 2019 at 10:06:20AM +0100, Robert Pluim wrote:
>> Alan Third <[email-masked]> writes:
>> 
>> > I believe it’s a problem with running redisplay rapidly (sit-for) and
>> > the way we’re drawing in NS. We end up with macOS demanding a screen
>> > update, and Emacs unable to deliver due to there being another
>> > redisplay coming up.
>> >
>> > The patch attached to this discussion doesn’t have the problem:
>> >
>> > https://lists.gnu.org/archive/html/emacs-devel/2019-02/msg00354.html
>> >
>> > However Robert Pluim reported serious performance problems with it. I
>> > haven’t been able to replicate them.
>> 
>> I can try it again. Perhaps something in my configuration is causing
>> this.
>
> If you can try and track it down that would be very helpful.
>
> The only thing I can think of that could make it very slow is drawing
> the buffer to the screen, but that really shouldn’t be as slow as
> you’re experiencing, it is, after all, just drawing an image to the
> screen.

To be clear: the slowness I experience does not seem wholly related to
redisplay: if I move down in a file using 'C-n', without the buffer
scrolling, the movement is very slow. Then when it does actually
update the screen because Iʼve moved point off the bottom, it is again
slow (by a rough measurement, moving from the top to the bottom of my
org file using C-v is approximately twice as slow).

(this is all with 'emacs -Q')

Iʼve just run another test where I scroll my org file programmatically
rather than interactively, and then your patch makes no discernable
difference:

(benchmark-run 1000
               (goto-char (point-min))
               (condition-case nil
                   (while t
                     (scroll-up-command))
                 (error nil)))
                 
takes ~15 seconds in both vanilla emacs-26 and with your patch.

Are there any other tests you'd like me to run? (I know nothing about
macOS profiling tools)

Robert