emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Agenda very slow with org-agenda-dimmed-blocked-tasks
@ 2015-08-11 11:31 Matt Lundin
  2015-08-11 11:34 ` Matt Lundin
  2015-08-11 12:46 ` Nicolas Goaziou
  0 siblings, 2 replies; 3+ messages in thread
From: Matt Lundin @ 2015-08-11 11:31 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 6516 bytes --]

The recent commit 570b1935e7db9913a2eb9084b6f1adc0d07a36cc dramatically
slowed down the generation of the agenda on my machine when
org-agenda-dimmed-blocked-tasks and org-enforce-todo-dependencies are
both set to t.

There seem to be an extraordinary number of calls to org-entry-blocked-p
and org-entry-get. Here's are the first several lines of profiling
information from a custom agenda command that has both of the settings
above enabled:

--8<---------------cut here---------------start------------->8---
   org-agenda-redo                                               1           7.827560172   7.827560172
   org-agenda-run-series                                         2           7.8218210500  3.9109105250
   org-let                                                       3           7.20083237    2.4002774566
   org-agenda-finalize                                           4           6.844503497   1.7111258742
   org-agenda-dim-blocked-tasks                                  1           6.699442204   6.699442204
   org-entry-blocked-p                                           9935        5.7348475660  0.0005772367
   org-block-todo-from-children-or-siblings-or-parent            9935        4.0232743180  0.0004049596
   org-entry-get                                                 20138       1.5084527930  7.490...e-05
   org-get-todo-state                                            47077       1.2677654579  2.692...e-05
   org-entry-is-done-p                                           29892       1.0612141059  3.550...e-05
   org-back-to-heading                                           89176       0.7644088809  8.571...e-06
   org-property--local-values                                    10203       0.6607707660  6.476...e-05
   org-outline-level                                             45939       0.6526133970  1.420...e-05
   org-entry-is-todo-p                                           16970       0.6425987680  3.786...e-05
   [snip]
--8<---------------cut here---------------end--------------->8---

By way of comparison here is the profiling information for the same
custom agenda command prior to the commit. Notice the 139 calls to
org-agenda-blocked-p compared to the 9935 above:

--8<---------------cut here---------------start------------->8---
   org-agenda-redo                                               1           2.16555618    2.16555618
   org-agenda-run-series                                         1           2.164402155   2.164402155
   org-let                                                       2           1.563410317   0.7817051585
   org-agenda-finalize                                           4           1.212033806   0.3030084515
   org-agenda-dim-blocked-tasks                                  1           1.170204698   1.170204698
   org-let2                                                      3           0.591343907   0.1971146356
   org-agenda-prepare                                            4           0.3530507439  0.0882626859
   org-agenda-prepare-buffers                                    1           0.327547542   0.327547542
   org-agenda-list-stuck-projects                                1           0.326917219   0.326917219
   org-tags-view                                                 1           0.326905634   0.326905634
   org-scan-tags                                                 50          0.3165784299  0.0063315685
   org-todo-list                                                 1           0.225206383   0.225206383
   org-set-regexps-and-options                                   50          0.198799971   0.0039759994
   org--setup-collect-keywords                                   50          0.1926802859  0.0038536057
   org-agenda-finalize-entries                                   3           0.183284111   0.0610947036
   org-element-at-point                                          100         0.1775049539  0.0017750495
   org-element--parse-to                                         100         0.174980767   0.0017498076
   org-agenda-highlight-todo                                     157         0.1738833260  0.0011075371
   org-element--cache-put                                        101         0.165917795   0.0016427504
   org-agenda-get-day-entries                                    100         0.063475662   0.0006347566
   org-refresh-category-properties                               50          0.045959423   0.0009191884
   org-agenda-list                                               1           0.03918709    0.03918709
   org-refresh-properties                                        100         0.034035472   0.0003403547
   org-agenda-get-todos                                          50          0.033929208   0.0006785841
   org-entry-blocked-p                                           139         0.0336150219  0.0002418346
   org-outline-level                                             3906        0.0276959979  7.090...e-06
   org-refresh-stats-properties                                  50          0.0250132949  0.0005002658
   org-block-todo-from-children-or-siblings-or-parent            139         0.0247768829  0.0001782509
   org-agenda-get-deadlines                                      50          0.0235243889  0.0004704877
   org-get-tags-at                                               308         0.0202068740  6.560...e-05
   org-refresh-effort-properties                                 50          0.018845043   0.0003769008
   org-get-priority                                              157         0.014716273   9.373...e-05
   org-up-heading-safe                                           236         0.0143668880  6.087...e-05
   org-get-todo-state                                            853         0.0134622469  1.578...e-05
   org-agenda-mode                                               1           0.012866926   0.012866926
   org-agenda-align-tags                                         1           0.011609398   0.011609398
   org-agenda-skip-eval                                          680         0.0115281949  1.695...e-05
   org-agenda-skip-entry-when-regexp-matches-in-subtree          125         0.0108022420  8.641...e-05
   org-entry-get                                                 145         0.0084927020  5.857...e-05
--8<---------------cut here---------------end--------------->8---

Minimal recipe to replicate:

a) Config file

--8<---------------cut here---------------start------------->8---

[-- Attachment #2: minimal.el --]
[-- Type: application/emacs-lisp, Size: 218 bytes --]

[-- Attachment #3: Type: text/plain, Size: 508 bytes --]

--8<---------------cut here---------------end--------------->8---

- /usr/bin/emacsclient -Q -l ~/config/minimal.el

b) Create ~/test.org and enter the following tree 10 times:

--8<---------------cut here---------------start------------->8---
* TODO A blocked task
** TODO A task 
--8<---------------cut here---------------end--------------->8---

c) Run the following commands

- M-x org-agenda t
- M-x elp-instrument-package RET org
- M-x org-agenda-redo

Here are the profiling results with the commit:


[-- Attachment #4: minimal-example-blocked-tasks-before-commit.txt --]
[-- Type: text/plain, Size: 9274 bytes --]

org-agenda-redo                                               1           0.075783146   0.075783146
org-let                                                       1           0.074308752   0.074308752
org-todo-list                                                 1           0.074301293   0.074301293
org-agenda-finalize-entries                                   1           0.060647768   0.060647768
org-entries-lessp                                             40          0.0590289540  0.0014757238
org-agenda-get-day-entries                                    1           0.00579922    0.00579922
org-agenda-get-todos                                          1           0.005716737   0.005716737
org-agenda-finalize                                           1           0.003920996   0.003920996
org-agenda-dim-blocked-tasks                                  1           0.002686523   0.002686523
org-entry-blocked-p                                           20          0.0023204930  0.0001160246
org-agenda-fit-window-to-buffer                               1           0.002024101   0.002024101
org-fit-window-to-buffer                                      1           0.001988932   0.001988932
org-get-tags-at                                               40          0.0018471419  4.617...e-05
org-block-todo-from-children-or-siblings-or-parent            20          0.001525567   7.627835e-05
org-agenda-format-item                                        20          0.001350015   6.750075e-05
org-agenda-prepare                                            1           0.001326156   0.001326156
org-up-heading-safe                                           80          0.0013012599  1.626575e-05
org-agenda-highlight-todo                                     20          0.001223346   6.11673e-05
org-entry-get                                                 30          0.0009493300  3.164...e-05
org-outline-level                                             170         0.0008719429  5.129...e-06
org-back-to-heading                                           230         0.000703085   3.056...e-06
org-property--local-values                                    30          0.000674644   2.248...e-05
org-get-property-block                                        30          0.0006162890  2.054...e-05
org-trim                                                      40          0.000530127   1.325...e-05
org-em                                                        700         0.0005297579  7.567...e-07
org-get-priority                                              20          0.00051482    2.574...e-05
org-agenda-prepare-buffers                                    1           0.000484229   0.000484229
org-get-todo-state                                            40          0.0003871889  9.679...e-06
org-add-props                                                 60          0.000343512   5.7252e-06
org-agenda-entry-get-agenda-timestamp                         20          0.0003147379  1.57369e-05
org-agenda-skip                                               20          0.000289489   1.447...e-05
org-agenda-mode                                               1           0.000254148   0.000254148
org-agenda-new-marker                                         20          0.0002131759  1.065...e-05
org-refresh-category-properties                               1           0.000135219   0.000135219
org-before-first-heading-p                                    30          0.000129829   4.327...e-06
org-agenda-files                                              3           0.0001217309  4.057...e-05
org-cmp-values                                                40          0.000107732   2.6933e-06
org-entry-is-done-p                                           10          0.0001061900  1.061...e-05
org-cmp-category                                              40          9.609...e-05  2.402...e-06
org-get-todo-face                                             20          9.441...e-05  4.720...e-06
org-entry-is-todo-p                                           10          9.056e-05     9.056e-06
org-set-regexps-and-options                                   1           8.8796e-05    8.8796e-05
org-get-heading                                               10          8.3972e-05    8.3972e-06
org-get-time-of-day                                           20          8.2655e-05    4.13275e-06
org-unhighlight                                               2           7.8921e-05    3.94605e-05
org-get-category                                              20          7.8017e-05    3.90085e-06
org-agenda-fix-displayed-tags                                 20          7.628...e-05  3.814...e-06
org-detach-overlay                                            2           6.3885e-05    3.19425e-05
org-agenda-align-tags                                         1           6.2838e-05    6.2838e-05
org-in-src-block-p                                            20          5.9543e-05    2.97715e-06
org-refresh-stats-properties                                  1           5.8101e-05    5.8101e-05
org-compile-prefix-format                                     1           5.8062e-05    5.8062e-05
org-looking-at-p                                              30          4.612...e-05  1.537...e-06
org-check-agenda-file                                         2           4.4402e-05    2.2201e-05
org-get-agenda-file-buffer                                    2           4.26e-05      2.13e-05
org-activate-plain-links                                      1           4.1271e-05    4.1271e-05
org-add-hook                                                  4           3.980...e-05  9.951...e-06
org-remove-uninherited-tags                                   40          3.795...e-05  9.489...e-07
org-find-base-buffer-visiting                                 2           3.5687e-05    1.78435e-05
org-get-at-bol                                                22          3.454e-05     1.57e-06
org-refresh-properties                                        2           3.194...e-05  1.597...e-05
org-make-options-regexp                                       1           3.1266e-05    3.1266e-05
org-agenda-skip-eval                                          40          3.017...e-05  7.543...e-07
org--setup-collect-keywords                                   1           3.0002e-05    3.0002e-05
org-agenda-get-category-icon                                  20          2.7342e-05    1.3671e-06
org-today                                                     2           2.465...e-05  1.232...e-05
org-not-nil                                                   40          2.111...e-05  5.2795e-07
org-refresh-effort-properties                                 1           2.0797e-05    2.0797e-05
org-face-from-face-or-color                                   20          1.998...e-05  9.994...e-07
org-activate-bracket-links                                    1           1.9904e-05    1.9904e-05
org-reduced-level                                             20          1.9249e-05    9.6245e-07
org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item  20          1.735...e-05  8.676...e-07
org-agenda-mark-header-line                                   2           1.7215e-05    8.6075e-06
org-agenda-fontify-priorities                                 1           1.6987e-05    1.6987e-05
org-agenda-reset-markers                                      1           1.6665e-05    1.6665e-05
org-current-line                                              2           1.616e-05     8.08e-06
org-float-time                                                20          1.3168e-05    6.584e-07
org--setup-process-tags                                       1           1.2282e-05    1.2282e-05
org-agenda-span-name                                          5           1.111...e-05  2.2236e-06
org-re-property                                               1           1.1077e-05    1.1077e-05
org-agenda-prepare-window                                     1           1.0824e-05    1.0824e-05
org-uniquify                                                  5           1.0212e-05    2.0424e-06
org-set-local                                                 6           9.230...e-06  1.538...e-06
org-agenda-set-mode-name                                      1           9.008e-06     9.008e-06
org-agenda-update-agenda-type                                 2           8.613e-06     4.3065e-06
org-agenda-propertize-selected-todo-keywords                  1           4.216e-06     4.216e-06
org-goto-line                                                 1           3.753e-06     3.753e-06
org-set-sorting-strategy                                      1           2.596e-06     2.596e-06
org-uniquify-alist                                            1           2.033e-06     2.033e-06
org-font-lock-add-tag-faces                                   1           1.351e-06     1.351e-06
org-file-menu-entry                                           1           1.284e-06     1.284e-06
org-agenda-use-sticky-p                                       1           1.011e-06     1.011e-06
org-agenda-mark-clocking-task                                 1           8.93e-07      8.93e-07

[-- Attachment #5: Type: text/plain, Size: 51 bytes --]


Here are the profiling results after the commit:


[-- Attachment #6: minimal-example-blocked-tasks-after-commit.txt --]
[-- Type: text/plain, Size: 9487 bytes --]

org-agenda-redo                                               1           0.288310367   0.288310367
org-let                                                       1           0.285087688   0.285087688
org-todo-list                                                 1           0.285079274   0.285079274
org-agenda-finalize                                           1           0.272012485   0.272012485
org-agenda-dim-blocked-tasks                                  1           0.270325613   0.270325613
org-entry-blocked-p                                           580         0.1940442360  0.0003345590
org-block-todo-from-children-or-siblings-or-parent            580         0.1009711290  0.0001740881
org-entry-get                                                 1410        0.0965856959  6.850...e-05
org-up-heading-safe                                           560         0.0680727980  0.0001215585
org-property--local-values                                    830         0.0167895950  2.022...e-05
org-get-property-block                                        830         0.0152417820  1.836...e-05
org-entry-properties                                          580         0.0099000929  1.706...e-05
org-back-to-heading                                           3850        0.0096790799  2.514...e-06
org-outline-level                                             2010        0.0092372650  4.595...e-06
org-agenda-get-day-entries                                    1           0.005782133   0.005782133
org-agenda-get-todos                                          1           0.005699159   0.005699159
org-get-todo-state                                            680         0.0055059249  8.096...e-06
org-get-at-bol                                                581         0.0043025709  7.405...e-06
org-agenda-finalize-entries                                   1           0.003616882   0.003616882
org-before-first-heading-p                                    830         0.0034598270  4.168...e-06
org-entry-is-done-p                                           330         0.0033791759  1.023...e-05
org-entry-is-todo-p                                           330         0.0031137890  9.435...e-06
org-get-heading                                               330         0.0026260989  7.957...e-06
org-get-tags-at                                               40          0.001983332   4.95833e-05
org-entries-lessp                                             40          0.001960238   4.900595e-05
org-agenda-fit-window-to-buffer                               1           0.001945965   0.001945965
org-fit-window-to-buffer                                      1           0.001917771   0.001917771
org-agenda-format-item                                        20          0.0013505519  6.75276e-05
org-agenda-highlight-todo                                     20          0.0012644160  6.322...e-05
org-looking-at-p                                              830         0.0012345849  1.487...e-06
org-agenda-prepare                                            1           0.001124014   0.001124014
org-match-string-no-properties                                580         0.0007045290  1.214...e-06
org-em                                                        700         0.0005474830  7.821...e-07
org-not-nil                                                   1080        0.0005435310  5.032...e-07
org-trim                                                      40          0.0005423520  1.355...e-05
org-agenda-prepare-buffers                                    1           0.000515622   0.000515622
org-get-priority                                              20          0.000501921   2.509...e-05
org-add-props                                                 60          0.0003515730  5.859...e-06
org-agenda-entry-get-agenda-timestamp                         20          0.000322989   1.614945e-05
org-agenda-skip                                               20          0.000281676   1.40838e-05
org-agenda-mode                                               1           0.000220725   0.000220725
org-agenda-new-marker                                         20          0.0002005160  1.002...e-05
org-refresh-category-properties                               1           0.000139015   0.000139015
org-agenda-files                                              3           0.0001187149  3.957...e-05
org-get-todo-face                                             20          9.5821e-05    4.791...e-06
org-cmp-category                                              40          9.496...e-05  2.374...e-06
org-set-regexps-and-options                                   1           9.116e-05     9.116e-05
org-cmp-values                                                40          8.382...e-05  2.095...e-06
org-get-time-of-day                                           20          8.205...e-05  4.10295e-06
org-get-category                                              20          8.1716e-05    4.0858e-06
org-agenda-fix-displayed-tags                                 20          7.4785e-05    3.73925e-06
org-agenda-align-tags                                         1           6.3915e-05    6.3915e-05
org-in-src-block-p                                            20          5.9565e-05    2.978...e-06
org-refresh-stats-properties                                  1           5.8709e-05    5.8709e-05
org-compile-prefix-format                                     1           5.553e-05     5.553e-05
org-check-agenda-file                                         2           4.4228e-05    2.2114e-05
org-get-agenda-file-buffer                                    2           4.420...e-05  2.210...e-05
org-activate-plain-links                                      1           3.7979e-05    3.7979e-05
org-remove-uninherited-tags                                   40          3.796...e-05  9.491...e-07
org-find-base-buffer-visiting                                 2           3.593...e-05  1.796...e-05
org-make-options-regexp                                       1           3.4553e-05    3.4553e-05
org-refresh-properties                                        2           3.2276e-05    1.6138e-05
org-agenda-skip-eval                                          40          3.026...e-05  7.566...e-07
org--setup-collect-keywords                                   1           2.7909e-05    2.7909e-05
org-agenda-get-category-icon                                  20          2.5506e-05    1.275...e-06
org-today                                                     2           2.495e-05     1.2475e-05
org-refresh-effort-properties                                 1           2.1299e-05    2.1299e-05
org-reduced-level                                             20          1.9957e-05    9.9785e-07
org-unhighlight                                               2           1.811...e-05  9.057...e-06
org-face-from-face-or-color                                   20          1.811...e-05  9.056...e-07
org-agenda-reset-markers                                      1           1.7852e-05    1.7852e-05
org-agenda-mark-header-line                                   2           1.7597e-05    8.7985e-06
org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item  20          1.7074e-05    8.537e-07
org-agenda-fontify-priorities                                 1           1.6277e-05    1.6277e-05
org-add-hook                                                  4           1.554...e-05  3.886...e-06
org-current-line                                              2           1.48e-05      7.4e-06
org-agenda-set-mode-name                                      1           1.4106e-05    1.4106e-05
org-float-time                                                20          1.3699e-05    6.8495e-07
org-activate-bracket-links                                    1           1.3416e-05    1.3416e-05
org--setup-process-tags                                       1           1.2782e-05    1.2782e-05
org-agenda-span-name                                          5           1.0024e-05    2.0048e-06
org-uniquify                                                  5           9.919...e-06  1.983...e-06
org-agenda-prepare-window                                     1           9.533e-06     9.533e-06
org-re-property                                               1           9.248e-06     9.248e-06
org-set-local                                                 6           8.811e-06     1.468...e-06
org-agenda-update-agenda-type                                 2           7.759e-06     3.8795e-06
org-agenda-propertize-selected-todo-keywords                  1           5.426e-06     5.426e-06
org-detach-overlay                                            2           5.065e-06     2.5325e-06
org-goto-line                                                 1           4.574e-06     4.574e-06
org-set-sorting-strategy                                      1           2.123e-06     2.123e-06
org-file-menu-entry                                           1           1.72e-06      1.72e-06
org-uniquify-alist                                            1           1.621e-06     1.621e-06
org-font-lock-add-tag-faces                                   1           1.095e-06     1.095e-06
org-agenda-mark-clocking-task                                 1           7.43e-07      7.43e-07
org-agenda-use-sticky-p                                       1           6.86e-07      6.86e-07

[-- Attachment #7: Type: text/plain, Size: 16 bytes --]


Thanks,
Matt



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Agenda very slow with org-agenda-dimmed-blocked-tasks
  2015-08-11 11:31 Agenda very slow with org-agenda-dimmed-blocked-tasks Matt Lundin
@ 2015-08-11 11:34 ` Matt Lundin
  2015-08-11 12:46 ` Nicolas Goaziou
  1 sibling, 0 replies; 3+ messages in thread
From: Matt Lundin @ 2015-08-11 11:34 UTC (permalink / raw)
  To: Org Mode

Matt Lundin <mdl@imapmail.org> writes:

> Minimal recipe to replicate:
>
> a) Config file

Here's the minimal config. (The inline attachment didn't display
properly in gnus on my end).

(add-to-list 'load-path "~/org-mode/lisp")
(add-to-list 'load-path "~/org-mode/contrib/lisp")

(setq org-enforce-todo-dependencies t)
(setq org-agenda-dim-blocked-tasks t)
(setq org-agenda-files '("~/test.org"))

Best,
Matt

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Agenda very slow with org-agenda-dimmed-blocked-tasks
  2015-08-11 11:31 Agenda very slow with org-agenda-dimmed-blocked-tasks Matt Lundin
  2015-08-11 11:34 ` Matt Lundin
@ 2015-08-11 12:46 ` Nicolas Goaziou
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Goaziou @ 2015-08-11 12:46 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Org Mode

Hello,

Matt Lundin <mdl@imapmail.org> writes:

> The recent commit 570b1935e7db9913a2eb9084b6f1adc0d07a36cc dramatically
> slowed down the generation of the agenda on my machine when
> org-agenda-dimmed-blocked-tasks and org-enforce-todo-dependencies are
> both set to t.
>
> There seem to be an extraordinary number of calls to org-entry-blocked-p
> and org-entry-get.

Oops. This is fixed. Thank you.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-11 12:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-11 11:31 Agenda very slow with org-agenda-dimmed-blocked-tasks Matt Lundin
2015-08-11 11:34 ` Matt Lundin
2015-08-11 12:46 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).