emacs-devel
[Top][All Lists]
Advanced

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

Re: follow-mode: extremely slow in combination with org-mode


From: Alan Mackenzie
Subject: Re: follow-mode: extremely slow in combination with org-mode
Date: Sun, 17 Jun 2018 11:13:33 +0000
User-agent: Mutt/1.9.4 (2018-02-28)

Hello, Eli.

On Sun, Jun 17, 2018 at 11:12:39 +0300, Eli Zaretskii wrote:
> > From: Gerald Wildgruber <address@hidden>
> > CC: <address@hidden>
> > Date: Sun, 17 Jun 2018 08:57:22 +0200

> >           - follow-windows-start-end                            17606  57%
> >            - if                                                 17606  57%
> >             - let                                               17603  57%
> >              - let                                              17603  57%
> >               - while                                           17603  57%
> >                - setq                                           17599  57%
> >                 - cons                                          17599  57%
> >                  - cons                                         17599  57%
> >                   - cons                                        17599  57%
> >                    - follow-calc-win-end                        17591  57%
> >                     - let*                                      17591  57%
> >                      - if                                        9229  30%
> >                       + let                                      1115   3%
> >                       + pos-visible-in-window-p                    26   0%
> >                        posn-point                                8350  27%
> >                      + window-inside-pixel-edges                   12   0%

> Alan, why doesn't follow-calc-win-end doesn't just use window-end with
> last argument non-nil?  AFAU, that should allow you to compute the
> result using 1/4 of the processing time you now invest.  Why do you
> need all the rest in that function?  What am I missing?

I honestly don't know for sure.  But on 2014-04-27 I made a note in my
personal log:

    "In follow-calc-win-end, we check for EOB being visible in the
    window, rather than being the window-end.  There needs to be a
    comment here about what the last element means."

.  I wish I could decipher what I meant, then.  I think I might have
encountered a corner case, where EOB is _inside_ a window, possibly not
even the last window, and using window-end failed for some reason.

But I think follow-calc-win-end was in the original follow.el written by
Anders Lindgren.  Maybe, back in the mists of time, window-end didn't
work for some reason - maybe it hadn't yet acquired it's UPDATE
argument, or something like that.

follow-calc-win-end was much longer in Emacs-21.4, and carried the
comment "This function is optimized function for speed!".  It had got
shorter some time up to Emacs-24.5, where it had already started using
posn-point.  This rewrite was probably this:

    commit c93b886f957b55df4fe45d986c34242832ec4a28
    Author: Chong Yidong <address@hidden>
    Date:   Sun Apr 29 09:48:23 2012 +0800

        Fix Follow mode's calculation of window ends.

        * lisp/follow.el (follow-calc-win-end): Rewrite to handle partial
        screen lines correctly.
        (follow-avoid-tail-recenter): Minor cleanup.

        Fixes: debbugs:8390

Why we don't just use window-end, I don't know.  Maybe the sequence of
people who've modified follow-calc-win-end have all assumed their
predecessors understood why a simple window-end wasn't used.  If it is
something to do with EOB messing things up, maybe we could amend
window-end better to handle EOB.

Sorry I can't do any more than speculate, here.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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