Re: [Orgmode] Speeding up agenda display

2010-01-03 Thread Carsten Dominik


On Jan 3, 2010, at 4:40 AM, Andrew J. Korty wrote:


On Jan 2, 2010, at 14:37 , Carsten Dominik wrote:


I have been thinking about caching often
but always stopped implementing it because, being a plain text
system, there is always the possibility that thinks are being
changed behind the back of the cache.  How are you handling
updating the cache?


Well, I'm only using the cache while org-agenda is running -- it  
doesn't persist beyond that.  So I don't have to worry about the  
agenda files changing, but I get no added benefit for subsequent  
agenda builds.



Ah, OK.

thanks.

- Carsten



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Speeding up agenda display

2010-01-02 Thread Andrew J. Korty
On Jan 2, 2010, at 02:50 , Carsten Dominik wrote:

 You can shave off another .5 seconds by pressing the selection key
 faster - Org spends 0.46 seconds to wait for your keypress :-)

Good point. :-)

I optimized things a bit more by caching skip positions and schedule, deadline, 
and tag data for each point a skip function is called in a hash.  An example 
hash value might be

  (((due-soon . t) (started . nil) (tagged-for-home . t)) . skip-position)

These savings add up when you have several slightly differing agendas in a 
block agenda.

ajk

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Speeding up agenda display

2010-01-02 Thread Carsten Dominik


On Jan 2, 2010, at 3:38 PM, Andrew J. Korty wrote:


On Jan 2, 2010, at 02:50 , Carsten Dominik wrote:


You can shave off another .5 seconds by pressing the selection key
faster - Org spends 0.46 seconds to wait for your keypress :-)


Good point. :-)

I optimized things a bit more by caching skip positions and  
schedule, deadline, and tag data for each point a skip function is  
called in a hash.  An example hash value might be


 (((due-soon . t) (started . nil) (tagged-for-home . t)) . skip- 
position)


These savings add up when you have several slightly differing  
agendas in a block agenda.


Hi Andrew,

that is interesting.  I have been thinking about caching often
but always stopped implementing it because, being a plain text
system, there is always the possibility that thinks are being
changed behind the back of the cache.  How are you handling
updating the cache?

- Carsten



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Speeding up agenda display

2010-01-02 Thread Andrew J. Korty
On Jan 2, 2010, at 14:37 , Carsten Dominik wrote:

 I have been thinking about caching often
 but always stopped implementing it because, being a plain text
 system, there is always the possibility that thinks are being
 changed behind the back of the cache.  How are you handling
 updating the cache?

Well, I'm only using the cache while org-agenda is running -- it doesn't 
persist beyond that.  So I don't have to worry about the agenda files changing, 
but I get no added benefit for subsequent agenda builds.

ajk

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Speeding up agenda display

2009-12-31 Thread Andrew J. Korty
Shaved off half a second.  So that's something!

ajk

org-agenda1   
1.534166  1.534166
org-let   1   
1.070332  1.070332
org-agenda-list   1   
1.070318  1.070318
org-agenda-get-day-entries1   
1.040049  1.040049
ajk/org-agenda-skip-if-not-due-soon   416 
0.503560  0.0012104807
org-agenda-get-scheduled  1   
0.478835  0.478835
org-agenda-get-restriction-and-command1   
0.463795  0.463795
ajk/org-agenda-skip-if-due-soon   416 
0.374392  0.0008999807
org-entry-get 425 
0.366792  0.00086304
org-entry-properties  416 
0.358245  0.0008611658
org-agenda-skip-entry-if  416 
0.309056  0.0007429254
org-agenda-skip-if416 
0.307708  0.0007396850
org-agenda-get-timestamps 1   
0.302895  0.302895
org-agenda-get-deadlines  1   
0.254305  0.254305
org-back-to-heading   991 
0.179074  0.0001807003
ajk/org-skip-position 419 
0.131751  0.0003144415
org-at-date-range-p   101 
0.037735  0.0003736237
org-prepare-agenda1   
0.022929  0.022929
org-prepare-agenda-buffers1   
0.022543  0.022543
org-agenda-skip   416 
0.019056  4.581...e-05
org-refresh-category-properties   1   
0.011837  0.011837
org-get-tags-at   3   
0.009567  0.003189
org-up-heading-safe   11  
0.009437  0.000857
org-deadline-close177 
0.008163  4.612...e-05
org-finalize-agenda   1   
0.005829  0.005829
org-agenda-dim-blocked-tasks  1   
0.005662  0.005662
org-get-property-block9   
0.005145  0.000571
org-days-to-time  177 
0.004461  2.520...e-05
org-get-todo-state119 
0.004413  3.708...e-05
org-format-agenda-item3   
0.003384  0.001127
org-get-effort3   
0.003145  0.001048
org-block-todo-from-children-or-siblings-or-parent3   
0.002877  0.000959
org-time-string-to-time   177 
0.002153  1.216...e-05
org-agenda-get-blocks 1   
0.002113  0.002113
org-entry-is-done-p   114 
0.002066  1.813...e-05
org-agenda-get-sexps  1   
0.001715  0.001715
ajk/org-agenda-skip-if-tagged-for-home11  
0.001621  0.0001473636
org-parse-time-string 184 
0.001281  6.961...e-06
org-get-priority  3   
0.000973  0.000324
org-fit-window-to-buffer  1   
0.000604  0.000604
org-get-category  420 
0.000423  1.007...e-06
org-get-wdays 180 
0.000419  2.333...e-06
org-trim  113 
0.000367  3.256...e-06
org-finalize-agenda-entries   1   
0.000337  0.000337
org-get-tags  11  
0.000304  2.763...e-05
org-time-string-to-absolute   7   
0.000292  4.185...e-05
org-agenda-mode   1   
0.000236  0.000236
org-agenda-highlight-todo 3   
0.000225  7.5e-05
org-agenda-files  3   
0.000218  7.266...e-05
org-get-tags-string   

[Orgmode] Speeding up agenda display

2009-12-30 Thread Andrew J. Korty
My agenda views take a couple seconds to build, and I'd like them to be faster. 
 I'm posting a portion of configuration and some profiling results here in case 
anyone can see any opportunities for optimization.

Some background: I don't use the diary at all -- this agenda view exists only 
to show me tasks that are due soon (and in this case, not tagged with @yard or 
@home).

Thanks,
ajk

(setq org-agenda-custom-commands
  '((o Due at Office agenda 
 ((org-agenda-skip-function
   '(or (org-agenda-skip-entry-if '(notdeadline))
(ajk/org-agenda-skip-if-not-due-soon)
(ajk/org-agenda-skip-if-tagged-for-home)))

(defun ajk/org-skip-position ()
  (or (save-excursion
(outline-next-heading)
(point))
  (point-max)))

(defun ajk/org-agenda-skip-if-not-due-soon ()
  (unless (ajk/org-agenda-skip-if-due-soon)
(ajk/org-skip-position)))

(defun ajk/org-agenda-skip-if-tagged-for-home ()
  (org-back-to-heading t)
  (let ((tags (org-get-tags)))
(if (or (member @home tags)
(member @yard tags))
(ajk/org-skip-position

(defun ajk/org-agenda-skip-if-action ()
  (if (org-get-todo-state)
  (ajk/org-skip-position)))

org-agenda1   
2.017599  2.017599
org-let   1   
1.33683   1.33683
org-agenda-list   1   
1.336819  1.336819
org-agenda-get-day-entries1   
1.30812   1.30812
org-entry-get 422 
0.924314  0.0021903175
org-entry-properties  416 
0.920302  0.0022122644
org-get-tags-at   418 
0.689975  0.0016506602
org-agenda-get-restriction-and-command1   
0.680728  0.680728
org-agenda-get-scheduled  1   
0.663837  0.663837
org-up-heading-safe   1055
0.654734  0.0006206018
org-agenda-get-deadlines  1   
0.545852  0.545852
org-agenda-skip-entry-if  416 
0.198253  0.0004765721
org-agenda-skip-if416 
0.196961  0.0004734639
org-back-to-heading   2439
0.100562  4.123...e-05
org-agenda-get-timestamps 1   
0.094435  0.094435
org-prepare-agenda1   
0.02532   0.02532
org-prepare-agenda-buffers1   
0.024896  0.024896
org-refresh-category-properties   1   
0.012516  0.012516
org-outline-level 1696
0.011961  7.052...e-06
org-deadline-close178 
0.008567  4.812...e-05
org-agenda-skip   416 
0.007149  1.718...e-05
org-get-tags-string   424 
0.005429  1.280...e-05
org-days-to-time  178 
0.004836  2.717...e-05
org-at-date-range-p   101 
0.004414  4.371...e-05
org-time-string-to-time   178 
0.002363  1.328...e-05
org-get-todo-state116 
0.002161  1.863...e-05
org-agenda-get-blocks 1   
0.002077  0.002077
org-entry-is-done-p   113 
0.001964  1.738...e-05
org-finalize-agenda   1   
0.001947  0.001947
org-agenda-dim-blocked-tasks  1   
0.001868  0.001868
org-agenda-get-sexps  1   
0.001698  0.001698
org-split-string  633 
0.001638  2.587...e-06
org-get-property-block6   
0.001411  0.0002351666
org-on-heading-p  424 
0.001399  3.301...e-06
org-parse-time-string 183 
0.001352  7.393...e-06
org-block-todo-from-children-or-siblings-or-parent2   
0.001044  0.000522
org-format-agenda-item2   
0.000966  0.000483
org-fit-window-to-buffer  1 

Re: [Orgmode] Speeding up agenda display

2009-12-30 Thread Andrew J. Korty
On Dec 30, 2009, at 14:20 , Carsten Dominik wrote:

 could you please also instrument your ajk/ functions for profiling and
 repeat the experiment? And show the code of all these functions, not
 only some (I am missing for example `ajk/org-agenda-skip-if-due-
 soon'

Yes to both -- see below for corrected listings of code and profiling results.

 Also:
 
 - Are you using property inheritance?
 - Are you relying on tag inheritance to check for @yard and @home?

No to both.

 - Are you using the latest version of Org-mode?

I'm using 6.33.

Btw, the single org file from which the agenda is generated contains 323 
headlines in the TODO state and 12,227 lines total.

Thanks,
ajk

(setq org-agenda-custom-commands
'((o Due at Office agenda 
   ((org-agenda-skip-function
 '(or (org-agenda-skip-entry-if '(notdeadline))
  (ajk/org-agenda-skip-if-not-due-soon)
  (ajk/org-agenda-skip-if-tagged-for-home)))

(defun ajk/org-skip-position ()
  (or (save-excursion
(outline-next-heading)
(point))
  (point-max)))

(defun ajk/org-agenda-skip-if-due-soon ()
  (and (let ((time (org-entry-get nil DEADLINE))) ; not due or not due soon
 (and time
  (org-deadline-close time)))
   (ajk/org-skip-position)))

(defun ajk/org-agenda-skip-if-not-due-soon ()
  (unless (ajk/org-agenda-skip-if-due-soon)
(ajk/org-skip-position)))

(defun ajk/org-agenda-skip-if-tagged-for-home ()
  (org-back-to-heading t)
  (let ((tags (org-get-tags)))
(if (or (member @home tags)
(member @yard tags))
(ajk/org-skip-position

org-agenda1   
1.997575  1.997575
org-let   1   
1.305759  1.305759
org-agenda-list   1   
1.305747  1.305747
org-agenda-get-day-entries1   
1.279215  1.279215
ajk/org-agenda-skip-if-not-due-soon   416 
1.034962  0.0024878918
ajk/org-agenda-skip-if-due-soon   416 
0.975166  0.0023441514
org-entry-get 422 
0.965561  0.0022880616
org-entry-properties  416 
0.961836  0.0023121081
org-get-tags-at   418 
0.698291  0.0016705526
org-agenda-get-restriction-and-command1   
0.691773  0.691773
org-up-heading-safe   1055
0.664914  0.0006302511
org-agenda-get-scheduled  1   
0.634158  0.634158
org-agenda-get-deadlines  1   
0.506933  0.506933
org-agenda-skip-entry-if  416 
0.138524  0.0003329927
org-agenda-skip-if416 
0.137230  0.0003298798
org-agenda-get-timestamps 1   
0.134207  0.134207
org-back-to-heading   2439
0.088765  3.639...e-05
ajk/org-skip-position 419 
0.058316  0.0001391813
org-prepare-agenda1   
0.023446  0.023446
org-prepare-agenda-buffers1   
0.022988  0.022988
org-refresh-category-properties   1   
0.012406  0.012406
org-outline-level 1696
0.011875  7.001...e-06
org-at-date-range-p   101 
0.009216  9.124...e-05
org-agenda-skip   416 
0.008605  2.068...e-05
org-deadline-close178 
0.008460  4.753...e-05
org-get-tags-string   424 
0.005351  1.262...e-05
org-days-to-time  178 
0.004724  2.653...e-05
org-time-string-to-time   178 
0.002268  1.274...e-05
org-get-todo-state116 
0.002221  1.915...e-05
org-agenda-get-blocks 1   
0.002071  0.002071
org-entry-is-done-p   113 
0.001985  1.756...e-05
org-agenda-get-sexps  1   
0.001713  0.001713
org-finalize-agenda   1   
0.001653  0.001653
org-split-string

Re: [Orgmode] Speeding up agenda display

2009-12-30 Thread Carsten Dominik

Hi Andrew, thanks!

The only thing I see now is this:

1. Get the latest development version.  A week or two ago I made
   an optimization that should speed up

   (org-entry-get nil DEADLINE)

   quite a bit.

Let's see if that does help enough.

- Carsten

On Dec 30, 2009, at 8:40 PM, Andrew J. Korty wrote:


On Dec 30, 2009, at 14:20 , Carsten Dominik wrote:

could you please also instrument your ajk/ functions for profiling  
and

repeat the experiment? And show the code of all these functions, not
only some (I am missing for example `ajk/org-agenda-skip-if-due-
soon'


Yes to both -- see below for corrected listings of code and  
profiling results.



Also:

- Are you using property inheritance?
- Are you relying on tag inheritance to check for @yard and @home?


No to both.


- Are you using the latest version of Org-mode?


I'm using 6.33.

Btw, the single org file from which the agenda is generated contains  
323 headlines in the TODO state and 12,227 lines total.


Thanks,
ajk

(setq org-agenda-custom-commands
   '((o Due at Office agenda 
  ((org-agenda-skip-function
'(or (org-agenda-skip-entry-if '(notdeadline))
 (ajk/org-agenda-skip-if-not-due-soon)
 (ajk/org-agenda-skip-if-tagged-for-home)))

(defun ajk/org-skip-position ()
 (or (save-excursion
   (outline-next-heading)
   (point))
 (point-max)))

(defun ajk/org-agenda-skip-if-due-soon ()
 (and (let ((time (org-entry-get nil DEADLINE))) ; not due or not  
due soon

(and time
 (org-deadline-close time)))
  (ajk/org-skip-position)))

(defun ajk/org-agenda-skip-if-not-due-soon ()
 (unless (ajk/org-agenda-skip-if-due-soon)
   (ajk/org-skip-position)))

(defun ajk/org-agenda-skip-if-tagged-for-home ()
 (org-back-to-heading t)
 (let ((tags (org-get-tags)))
   (if (or (member @home tags)
   (member @yard tags))
   (ajk/org-skip-position

org-agenda 
1   1.997575  1.997575
org-let
1   1.305759  1.305759
org-agenda-list
1   1.305747  1.305747
org-agenda-get-day-entries 
1   1.279215  1.279215
ajk/org-agenda-skip-if-not-due-soon
416 1.034962  0.0024878918
ajk/org-agenda-skip-if-due-soon
416 0.975166  0.0023441514
org-entry-get  
422 0.965561  0.0022880616
org-entry-properties   
416 0.961836  0.0023121081
org-get-tags-at
418 0.698291  0.0016705526
org-agenda-get-restriction-and-command 
1   0.691773  0.691773
org-up-heading-safe
10550.664914  0.0006302511
org-agenda-get-scheduled   
1   0.634158  0.634158
org-agenda-get-deadlines   
1   0.506933  0.506933
org-agenda-skip-entry-if   
416 0.138524  0.0003329927
org-agenda-skip-if 
416 0.137230  0.0003298798
org-agenda-get-timestamps  
1   0.134207  0.134207
org-back-to-heading
24390.088765  3.639...e-05
ajk/org-skip-position  
419 0.058316  0.0001391813
org-prepare-agenda 
1   0.023446  0.023446
org-prepare-agenda-buffers 
1   0.022988  0.022988
org-refresh-category-properties
1   0.012406  0.012406
org-outline-level  
16960.011875  7.001...e-06
org-at-date-range-p
101 0.009216  9.124...e-05
org-agenda-skip
416 0.008605  2.068...e-05
org-deadline-close 
178 0.008460  4.753...e-05
org-get-tags-string
424 0.005351  1.262...e-05
org-days-to-time   
178 0.004724  2.653...e-05
org-time-string-to-time
178 0.002268  1.274...e-05
org-get-todo-state 
116 0.002221  1.915...e-05
org-agenda-get-blocks  
1   0.002071  0.002071
org-entry-is-done-p