Subject: Re: bug#42406: Mouse-wheel scrolling can be flickering

From: Stefan Monnier <[email-masked]>
Date: Thu, 17 Dec 2020 16:24:01 -0500

> If we want to make any improvements in redisplay efficiency, we should
> simply toss what we have and start anew, redefining each flag
> accurately and adding more flags/values to augment the existing ones.

AFAIK that's exactly what I did with the `redisplay` bits.

> Globals like update_mode_lines should simply go away: how long does it
> take to loop over all the frames/windows and set the corresponding
> flag of each one of them (not that I see why we would even need to do
> that for all the windows)?

And indeed, my `redisplay` bits intend to replace that
global variable, tho I've kept it for now in order to make the change
more conservative: while looping over all the windows/frames may be fast
if you do it once per command, it's quite possible to run code that sets
`update_mode_lines` many times in a single command, and if you have
a hundred frames/windows like I often do, this could end up making the
code measurably slower in some corner cases.  I doubt I'd be bothered,
but I didn't want to take the risk of introducing such
performance regressions.

Similarly, I kept the special case where we only consider the selected
window.  We could get rid of it and only rely on the `redisplay` bits
instead, but it could make things marginally slower in some cases, and
it would have a required more work to try and better understand what
that "selected window only" code path does to make sure I wasn't
introducing any regression.

> And the window's update_mode_line flag should not be used for deciding
> about all the -lines and frame-title, we should instead have much more
> fine-grained flags that would allow us to make separate decisions
> regarding each one of them;

That would be nice, yes.  But that's largely independent from the bug
under discussion, where the performance seems to be adequate with the
current coarse grained flags as long as we have a single frame, so the
problem seems to be that we consider all frames instead of only
considering those displaying the affected windows.

        Stefan