unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Gerald Wildgruber <wildgruber@tu-berlin.de>, emacs-devel@gnu.org
Subject: Re: follow-mode: extremely slow in combination with org-mode
Date: Sun, 17 Jun 2018 11:13:33 +0000	[thread overview]
Message-ID: <20180617111333.GA12093@ACM> (raw)
In-Reply-To: <83lgbdu8zs.fsf@gnu.org>

Hello, Eli.

On Sun, Jun 17, 2018 at 11:12:39 +0300, Eli Zaretskii wrote:
> > From: Gerald Wildgruber <wildgruber@tu-berlin.de>
> > CC: <emacs-devel@gnu.org>
> > 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 <cyd@gnu.org>
    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	other threads:[~2018-06-17 11:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-16 10:25 follow-mode: extremely slow in combination with org-mode Gerald Wildgruber
2018-06-16 11:41 ` Eli Zaretskii
2018-06-16 13:06   ` Gerald Wildgruber
2018-06-16 16:25     ` Eli Zaretskii
2018-06-16 21:05       ` Gerald Wildgruber
2018-06-17  6:57       ` Gerald Wildgruber
2018-06-17  8:12         ` Eli Zaretskii
2018-06-17 11:13           ` Alan Mackenzie [this message]
2018-06-17 13:02             ` Eli Zaretskii
2018-06-17 14:56               ` Gerald Wildgruber
2018-06-17 15:10                 ` Eli Zaretskii
2018-06-19 12:08                   ` Gerald Wildgruber
2018-06-19 16:55                     ` Eli Zaretskii
2018-06-19 13:53                   ` Gerald Wildgruber
2018-06-17 15:13             ` Eli Zaretskii
2018-06-21  8:25 ` Anders Lindgren
2018-06-27 16:43   ` Gerald Wildgruber
2018-07-09 20:12     ` Anders Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180617111333.GA12093@ACM \
    --to=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=wildgruber@tu-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).