[Top][All Lists]

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

Re: Tick Reduction

From: Eli Zaretskii
Subject: Re: Tick Reduction
Date: Fri, 19 Nov 2021 21:50:39 +0200

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: larsi@gnus.org,  emacs-devel@gnu.org
> Date: Fri, 19 Nov 2021 14:24:46 -0500
> > That is only true when the window is redisplayed in its entirety, top
> > to bottom.  This happens relatively rarely, because the display engine
> > tries very hard not to redisplay much more than absolutely necessary.
> > These redisplay optimizations are generally structure as follows:
> >
> >  . find the beginning and the end of the part of the buffer that needs
> >    to be redisplayed
> >  . redisplay that part starting at its beginning and going to its end
> >
> > This could result in redisplaying just one line, for example, or all
> > lines between N and M.  Which means that redisplay of a window can
> > start at some arbitrary point in the middle of the window, without
> > knowing anything about the preceding lines, except that they weren't
> > changed on the glass.
> IIUC this isn't quite true: the "old" glyph matrix still contains the
> rendering result of the previous lines and while it's old, it's still
> up-to-date, so we might be able to extract the alignment info we need
> from that.

The display code only assumes the current glyph matrix is up-to-date
if a set of very conservative tests succeeds.  In the other cases, it
doesn't use the contents of the current glyph matrix.

And if this is not enough, let me remind you that the display engine
also includes a set of functions that "emulate" redisplay, and those
cannot use the glyph matrices at all, because they many times are used
for text that is not displayed at all.

> >> so I think we could handle the case of "align
> >> with some previous line" (with some non-trivial caveats since it means
> >> that future changes in that previous line would need to cause POS to be
> >> re-processed, which may require disabling some optimizations).
> > What you want would require every redisplay to always redraw the
> > entire window.  IOW, disable _all_ redisplay optimizations.
> Not necessarily always: we could record dependencies between lines of
> the glyph matrix such that we only grow the set of redisplayed lines
> when it's actually needed (i.e. when the corresponding text does use
> such cross-line alignment).

Anything can be implemented: this is software, after all.  All I'm
saying is that it won't be easy, not at all.  And once again, the
display code tries very hard not to use the current glyph matrix
because there's no good way of knowing when it's up to date,
especially when you are in the middle of some Lisp code.

reply via email to

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