From: Gerald Wildgruber <wildgruber@tu-berlin.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Alan Mackenzie <acm@muc.de>, emacs-devel@gnu.org
Subject: Re: follow-mode: extremely slow in combination with org-mode
Date: Sun, 17 Jun 2018 16:56:00 +0200 [thread overview]
Message-ID: <87tvq1qx6n.fsf@tu-berlin.de> (raw)
In-Reply-To: <83k1qxtvkt.fsf@gnu.org>
Thanks again Eli and Alan for picking this up!
Eli: the patch didn't apply cleanly (with "patch -p1 <" or "git apply"),
but as it is so simple I applied it manually.
follow-calc-win-end now looks like that:
==================================================
(defun follow-calc-win-end (&optional win)
"Calculate the end position for window WIN.
Return (END-POS END-OF-BUFFER).
Actually, the position returned is the start of the line after
the last fully-visible line in WIN. END-OF-BUFFER is t when EOB
is fully-visible in WIN. If WIN is nil, the selected window is
used."
(or win (setq win (selected-window)))
(with-selected-window win
(let* ((wend (window-end win t))
(endp (= wend (point-max))))
(and (> wend (point-min))
(setq wend (1- wend)))
(setq wend
(save-excursion
(goto-char wend)
(line-beginning-position)))
(list wend endp))))
==================================================
I byte compiled the patched follow.el restarted emacs and began editing.
It actually seems somewhat faster, though not enormously; I will
continue working with this patched version to see how it goes; I have a
more problematic (=slower) machine in my office, and I'm am eager to
see, if it makes a difference there; at home, where I'm testing right
now, its a new quad core xeon with 64gb of ram, -- and it is kind of
strange that with such a machine fans start very audibly as soon as you
start TYPING (not video editing or the like) :-)
One more observation: it might be that the slowing down becomes more
noticeable, the closer point gets to the bottom of the last window
(lower right edge of my five-fold splitted emacs frame), but I couldn't
reproduce this consistently.
Please count on me for any other testing that might be necessary! I'm no
programmer but will do my best to deliver usable results.
Here's how the profile looks now, with the patched, uncompiled follow.el
loaded right before profiling:
- follow-post-command-hook 17642 40%
- if 17642 40%
- let 17642 40%
- save-current-buffer 17642 40%
- follow-adjust-window 17642 40%
- if 17642 40%
- progn 17642 40%
- let 17591 40%
- let* 17560 40%
- progn 16733 38%
- follow-windows-start-end 16730 38%
- if 16730 38%
- let 16730 38%
- let 16730 38%
- while 16730 38%
- setq 16719 38%
- cons 16564 37%
- cons 16560 37%
- cons 16560 37%
- follow-calc-win-end 16557 37%
- let 16557 37%
- save-current-buffer 16557 37%
- unwind-protect 16557 37%
- progn 16551 37%
let* 16548 37%
internal--after-with-selected-window 3 0%
+ follow-windows-start-end 155 0%
+ if 827 1%
+ follow-all-followers 27 0%
+ follow-avoid-tail-recenter 51 0%
+ command-execute 17015 38%
Gerald.
On So, Jun 17 2018, Eli Zaretskii <eliz@gnu.org> wrote:
> Gerald, could you try the following patch to follow-calc-win-end?
> Please first see if this makes it significantly faster in your use
> cases, and if so, please run with it for a while and see if there are
> some adverse effects. (If this is not faster, it isn't worth testing
> it more.)
>
> diff --git a/lisp/follow.el b/lisp/follow.el
> index fd397c0..c99fc93 100644
> --- a/lisp/follow.el
> +++ b/lisp/follow.el
> @@ -925,14 +925,17 @@ follow-calc-win-end
> the last fully-visible line in WIN. END-OF-BUFFER is t when EOB
> is fully-visible in WIN. If WIN is nil, the selected window is
> used."
> - (let* ((win (or win (selected-window)))
> - (edges (window-inside-pixel-edges win))
> - (ht (- (nth 3 edges) (nth 1 edges)))
> - (last-line-pos (posn-point (posn-at-x-y 0 (1- ht) win))))
> - (if (pos-visible-in-window-p last-line-pos win)
> - (let ((end (window-end win t)))
> - (list end (pos-visible-in-window-p (point-max) win)))
> - (list last-line-pos nil))))
> + (or win (setq win (selected-window)))
> + (with-selected-window win
> + (let* ((wend (window-end win t))
> + (endp (= wend (point-max))))
> + (and (> wend (point-min))
> + (setq wend (1- wend)))
> + (setq wend
> + (save-excursion
> + (goto-char wend)
> + (line-beginning-position)))
> + (list wend endp))))
>
> (defun follow-calc-win-start (windows pos win)
> "Determine the start of window WIN in a Follow mode window chain.
---------------------
Sent with mu4e
next prev parent reply other threads:[~2018-06-17 14:56 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
2018-06-17 13:02 ` Eli Zaretskii
2018-06-17 14:56 ` Gerald Wildgruber [this message]
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=87tvq1qx6n.fsf@tu-berlin.de \
--to=wildgruber@tu-berlin.de \
--cc=acm@muc.de \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/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).