* [PATCH] speedup redisplay of agenda item after change
@ 2012-09-28 17:01 Max Mikhanosha
2012-09-29 6:21 ` Bastien
2012-09-29 9:20 ` Carsten Dominik
0 siblings, 2 replies; 5+ messages in thread
From: Max Mikhanosha @ 2012-09-28 17:01 UTC (permalink / raw
To: emacs-orgmode
I had noticed that with large agendas (several hundred items), any
command that changes and re-displays the current item is slow. For
example something like changing priority with Shift-Up/Down key, can
take a second or two.
Most of that time is spent in (org-agenda-finalize) call, which is
responsible for putting finishes touches, such as fortifying [#A] as
bold when you change priority from [#B].
It seems that even if only single line had changed, the
(org-agenda-finalize) still processes entire agenda buffer, which is
the cause of the slowness.
Following patch changes (org-agenda-change-all-lines) to call
(org-agenda-finalize) for each line changed, with agenda buffer
narrowed to just that line, and it speeds up redisplay of current item
a lot, the Shift-Up changing of priority can almost keep up with
keyboard repeat rate on large agendas.
I was running with this patch for a month, and did not noticed any
problems so far.
From 432293f3c55308f3f76b0c5284ca696fb11f10ea Mon Sep 17 00:00:00 2001
From: Max Mikhanosha <max@openchat.com>
Date: Fri, 28 Sep 2012 09:02:07 -0400
Subject: [PATCH] speedup redisplay of agenda item after change
* lisp/org-agenda.el (org-agenda-change-all-lines): speedup
refresh of a single line of agenda by narrowing the agenda
buffer just that line before calling org-agenda-finalize-
---
lisp/org-agenda.el | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index ea607eb..30dd5bf 100755
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8079,9 +8079,11 @@ (defun org-agenda-change-all-lines (newhead hdmarker
undone-face done-face))))
(org-agenda-highlight-todo 'line)
(beginning-of-line 1))
- (t (error "Line update did not work"))))
- (beginning-of-line 0)))
- (org-agenda-finalize)))
+ (t (error "Line update did not work")))
+ (save-restriction
+ (narrow-to-region (point-at-bol) (point-at-eol))
+ (org-agenda-finalize)))
+ (beginning-of-line 0)))))
(defun org-agenda-align-tags (&optional line)
"Align all tags in agenda items to `org-agenda-tags-column'."
--
1.7.11.rc0.100.g5498c5f
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] speedup redisplay of agenda item after change
2012-09-28 17:01 [PATCH] speedup redisplay of agenda item after change Max Mikhanosha
@ 2012-09-29 6:21 ` Bastien
2012-09-30 20:29 ` Max Mikhanosha
2012-09-29 9:20 ` Carsten Dominik
1 sibling, 1 reply; 5+ messages in thread
From: Bastien @ 2012-09-29 6:21 UTC (permalink / raw
To: Max Mikhanosha; +Cc: emacs-orgmode
Hi Max,
Max Mikhanosha <max@openchat.com> writes:
> Following patch changes (org-agenda-change-all-lines) to call
> (org-agenda-finalize) for each line changed, with agenda buffer
> narrowed to just that line, and it speeds up redisplay of current item
> a lot, the Shift-Up changing of priority can almost keep up with
> keyboard repeat rate on large agendas.
This is a great optimization trick, thanks a lot for this patch,
I just applied it.
> I was running with this patch for a month, and did not noticed any
> problems so far.
Did you run it with latest Org from maint, from master?
Also, would you like to get push access to the repo? I'd be glad.
Just send me your public key if so.
Thanks!
--
Bastien
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] speedup redisplay of agenda item after change
2012-09-28 17:01 [PATCH] speedup redisplay of agenda item after change Max Mikhanosha
2012-09-29 6:21 ` Bastien
@ 2012-09-29 9:20 ` Carsten Dominik
1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2012-09-29 9:20 UTC (permalink / raw
To: Max Mikhanosha; +Cc: emacs-orgmode
Looks great, and I see no reasons why this should break anything.
- Carsten
On 28.9.2012, at 19:01, Max Mikhanosha wrote:
> I had noticed that with large agendas (several hundred items), any
> command that changes and re-displays the current item is slow. For
> example something like changing priority with Shift-Up/Down key, can
> take a second or two.
>
> Most of that time is spent in (org-agenda-finalize) call, which is
> responsible for putting finishes touches, such as fortifying [#A] as
> bold when you change priority from [#B].
>
> It seems that even if only single line had changed, the
> (org-agenda-finalize) still processes entire agenda buffer, which is
> the cause of the slowness.
>
> Following patch changes (org-agenda-change-all-lines) to call
> (org-agenda-finalize) for each line changed, with agenda buffer
> narrowed to just that line, and it speeds up redisplay of current item
> a lot, the Shift-Up changing of priority can almost keep up with
> keyboard repeat rate on large agendas.
>
> I was running with this patch for a month, and did not noticed any
> problems so far.
>
> From 432293f3c55308f3f76b0c5284ca696fb11f10ea Mon Sep 17 00:00:00 2001
> From: Max Mikhanosha <max@openchat.com>
> Date: Fri, 28 Sep 2012 09:02:07 -0400
> Subject: [PATCH] speedup redisplay of agenda item after change
>
> * lisp/org-agenda.el (org-agenda-change-all-lines): speedup
> refresh of a single line of agenda by narrowing the agenda
> buffer just that line before calling org-agenda-finalize-
>
> ---
> lisp/org-agenda.el | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index ea607eb..30dd5bf 100755
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -8079,9 +8079,11 @@ (defun org-agenda-change-all-lines (newhead hdmarker
> undone-face done-face))))
> (org-agenda-highlight-todo 'line)
> (beginning-of-line 1))
> - (t (error "Line update did not work"))))
> - (beginning-of-line 0)))
> - (org-agenda-finalize)))
> + (t (error "Line update did not work")))
> + (save-restriction
> + (narrow-to-region (point-at-bol) (point-at-eol))
> + (org-agenda-finalize)))
> + (beginning-of-line 0)))))
>
> (defun org-agenda-align-tags (&optional line)
> "Align all tags in agenda items to `org-agenda-tags-column'."
> --
> 1.7.11.rc0.100.g5498c5f
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] speedup redisplay of agenda item after change
2012-09-29 6:21 ` Bastien
@ 2012-09-30 20:29 ` Max Mikhanosha
2012-09-30 21:20 ` Bastien
0 siblings, 1 reply; 5+ messages in thread
From: Max Mikhanosha @ 2012-09-30 20:29 UTC (permalink / raw
To: Bastien; +Cc: emacs-orgmode
At Sat, 29 Sep 2012 08:21:08 +0200,
Bastien wrote:
>
> Max Mikhanosha <max@openchat.com> writes:
>
> > Following patch changes (org-agenda-change-all-lines) to call
> > (org-agenda-finalize) for each line changed, with agenda buffer
> > narrowed to just that line, and it speeds up redisplay of current item
> > a lot, the Shift-Up changing of priority can almost keep up with
> > keyboard repeat rate on large agendas.
>
> This is a great optimization trick, thanks a lot for this patch,
> I just applied it.
>
> > I was running with this patch for a month, and did not noticed any
> > problems so far.
>
> Did you run it with latest Org from maint, from master?
No sorry I had not tried with maint, just with head of the repository.
> Also, would you like to get push access to the repo? I'd be glad.
> Just send me your public key if so.
I've had commit access (for sticky agenda), so unless someone removed
me I should still have it.
The reason I did not commit it directly, that its kind of innocent
looking change but in the sensitive area of the code, so I wanted more
eyes / testing on it first. If there is anything broken by it, my
guess it could bulk commands, clocking and/or undo stuff, and I'm not
these much.
Regards,
Max
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] speedup redisplay of agenda item after change
2012-09-30 20:29 ` Max Mikhanosha
@ 2012-09-30 21:20 ` Bastien
0 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2012-09-30 21:20 UTC (permalink / raw
To: emacs-orgmode
Max Mikhanosha <max@openchat.com> writes:
> I've had commit access (for sticky agenda), so unless someone removed
> me I should still have it.
Yes, you still have it.
> The reason I did not commit it directly, that its kind of innocent
> looking change but in the sensitive area of the code, so I wanted more
> eyes / testing on it first. If there is anything broken by it, my
> guess it could bulk commands, clocking and/or undo stuff, and I'm not
> these much.
Org 7.9.2 is now in Emacs 24.3. The Emacs trunk is in feature freeze
(for about one month) so we will have time to chase bugs in this area,
that's why I committed this early (after some testing on my side though.)
Thanks again,
--
Bastien
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-09-30 21:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-28 17:01 [PATCH] speedup redisplay of agenda item after change Max Mikhanosha
2012-09-29 6:21 ` Bastien
2012-09-30 20:29 ` Max Mikhanosha
2012-09-30 21:20 ` Bastien
2012-09-29 9:20 ` Carsten Dominik
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.