emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Dramatic slowdown in org mode
@ 2012-12-18 21:05 Fraga, Eric
  2012-12-18 21:47 ` Abdó Roig-Maranges
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Fraga, Eric @ 2012-12-18 21:05 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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

Hello,

sometime between last week and today, there has been a dramatic slowdown in the generation of an agenda view.  Using elp to instrument the org package and then asking for the default agenda view (C-c a a), I get the attached results.  The agenda view takes just under 2 seconds with org from commit 47ea1666 (12 December) and over 30 seconds with org from commit 76cf2538 (today, up to date).  I have attached the two outputs from elp.

Unfortunately, I haven't had the chance to go through the changes over the past week to see if I could identify which one causes the dramatic change in performance.

Thanks,
eric

[-- Attachment #2: elp-47ea1666.txt --]
[-- Type: text/plain, Size: 10323 bytes --]

org-agenda                                                    1           1.761614798   1.761614798
org-agenda-list                                               1           1.578568495   1.578568495
org-agenda-get-day-entries                                    14          1.2357858689  0.0882704192
org-agenda-get-scheduled                                      14          0.9519977079  0.0679998362
org-entry-get                                                 589         0.4575541829  0.0007768322
org-get-property-block                                        589         0.4306466940  0.0007311488
org-back-to-heading                                           1962        0.3531446199  0.0001799921
org-get-todo-state                                            773         0.239770826   0.0003101821
org-agenda-prepare                                            1           0.213085072   0.213085072
org-agenda-prepare-buffers                                    1           0.209823313   0.209823313
org-agenda-get-restriction-and-command                        1           0.1829714909  0.1829714909
org-agenda-skip                                               813         0.178216573   0.0002192085
org-agenda-get-deadlines                                      14          0.1516758889  0.0108339920
org-before-first-heading-p                                    589         0.1033582670  0.0001754809
org-agenda-skip-eval                                          1624        0.0946857890  5.830...e-05
org-refresh-category-properties                               14          0.087657319   0.0062612370
org-get-tags-at                                               33          0.0726190890  0.0022005784
org-up-heading-safe                                           124         0.068383819   0.0005514824
org-end-of-subtree                                            83          0.0565531959  0.0006813638
org-agenda-get-sexps                                          14          0.0541387670  0.0038670547
org-agenda-get-timestamps                                     14          0.042689354   0.0030492395
org-time-string-to-absolute                                   758         0.0353096979  4.658...e-05
org-agenda-get-blocks                                         14          0.0323156729  0.0023082623
org-agenda-format-item                                        45          0.021494701   0.0004776600
org-get-effort                                                34          0.0134196910  0.0003946967
org-in-src-block-p                                            813         0.0134103450  1.649...e-05
org-outline-level                                             331         0.011762491   3.553...e-05
org-parse-time-string                                         836         0.0114203009  1.366...e-05
org-get-priority                                              31          0.011103502   0.0003581774
org-agenda-finalize-entries                                   1           0.007454607   0.007454607
org-agenda-finalize                                           1           0.006165148   0.006165148
org-at-date-range-p                                           36          0.00506606    0.0001407238
org-agenda-align-tags                                         1           0.005057498   0.005057498
org-backward-heading-same-level                               2           0.003762298   0.001881149
org-agenda-highlight-todo                                     45          0.0033643649  7.476...e-05
org-fit-window-to-buffer                                      1           0.003328753   0.003328753
org-diary-sexp-entry                                          27          0.002785114   0.0001031523
org-agenda-files                                              3           0.002448539   0.0008161796
org-agenda-add-time-grid-maybe                                1           0.002256168   0.002256168
org-closest-date                                              26          0.002233855   8.591...e-05
org-check-agenda-file                                         28          0.0020999359  7.499...e-05
org-get-agenda-file-buffer                                    28          0.001792991   6.403...e-05
org-entries-lessp                                             166         0.0017702189  1.066...e-05
org-agenda-mode                                               1           0.001742011   0.001742011
org-agenda-new-marker                                         64          0.001705999   2.665...e-05
org-trim                                                      87          0.0016152749  1.856...e-05
org-find-base-buffer-visiting                                 28          0.001526418   5.451...e-05
org-time-string-to-time                                       52          0.0015211780  2.925...e-05
org-add-props                                                 144         0.0012391679  8.605...e-06
org-agenda-todayp                                             29          0.001007214   3.473...e-05
org-get-wdays                                                 191         0.0008571499  4.487...e-06
org-date-to-gregorian                                         52          0.0007984180  1.535...e-05
org-agenda-fix-displayed-tags                                 45          0.0007469390  1.659...e-05
org-today                                                     30          0.0006703880  2.234...e-05
org-activate-plain-links                                      2           0.000643076   0.000321538
org-agenda-prepare-window                                     1           0.000535488   0.000535488
org-pop-to-buffer-same-window                                 1           0.000513117   0.000513117
org-get-time-of-day                                           27          0.00042504    1.574...e-05
org-remove-uninherited-tags                                   35          0.000369202   1.054...e-05
org-get-todo-face                                             31          0.0003230559  1.042...e-05
org-split-string                                              30          0.000320699   1.068...e-05
org-switch-to-buffer-other-window                             1           0.000299228   0.000299228
org-get-category                                              34          0.0002459649  7.234...e-06
org-uniquify                                                  6           0.0002425450  4.042...e-05
org-agenda-quit                                               1           0.000231966   0.000231966
org-agenda-Quit                                               1           0.000221555   0.000221555
org-downcase-keep-props                                       96          0.000211889   2.207...e-06
org-activate-bracket-links                                    2           0.000207097   0.0001035485
org-agenda-fontify-priorities                                 1           0.000128072   0.000128072
org-before-change-function                                    69          0.0001265470  1.834...e-06
org-float-time                                                64          0.0001251610  1.955...e-06
org-agenda-get-category-icon                                  45          0.0001002629  2.228...e-06
org-days-to-iso-week                                          3           9.8779e-05    3.292...e-05
org-at-heading-p                                              2           9.2248e-05    4.6124e-05
org-delete-all                                                35          7.658...e-05  2.188...e-06
org-reduced-level                                             33          7.462...e-05  2.261...e-06
org-compile-prefix-format                                     1           7.455e-05     7.455e-05
org-agenda-get-day-face                                       1           4.8089e-05    4.8089e-05
org-face-from-face-or-color                                   31          4.199...e-05  1.354...e-06
org-file-menu-entry                                           14          3.312...e-05  2.366...e-06
org-remove-flyspell-overlays-in                               2           2.9368e-05    1.4684e-05
org-agenda-deadline-face                                      8           2.620...e-05  3.275...e-06
org-agenda-reset-markers                                      3           2.558...e-05  8.528...e-06
org-add-hook                                                  3           1.9293e-05    6.431e-06
org-unhighlight                                               1           1.6632e-05    1.6632e-05
org-agenda-time-of-day-to-ampm-maybe                          12          1.591...e-05  1.326...e-06
org-agenda-mark-header-line                                   1           1.4361e-05    1.4361e-05
org-contextualize-keys                                        1           1.3023e-05    1.3023e-05
org-get-at-bol                                                1           9.484e-06     9.484e-06
org-agenda-set-mode-name                                      1           6.471e-06     6.471e-06
org-agenda-span-name                                          1           5.258e-06     5.258e-06
org-add-prop-inherited                                        2           4.421...e-06  2.210...e-06
org-agenda-mark-clocking-task                                 1           3.879e-06     3.879e-06
org-region-active-p                                           1           3.785e-06     3.785e-06
org-agenda-ndays-to-span                                      2           2.913e-06     1.4565e-06
org-agenda-update-agenda-type                                 1           2.531e-06     2.531e-06
org-detach-overlay                                            1           2.501e-06     2.501e-06
org-agenda-fit-window-to-buffer                               1           2.28e-06      2.28e-06
org-columns-remove-overlays                                   1           2.271e-06     2.271e-06
org-font-lock-add-tag-faces                                   1           2.05e-06      2.05e-06
org-set-sorting-strategy                                      1           1.85e-06      1.85e-06
org-agenda-use-sticky-p                                       1           1.709e-06     1.709e-06
org-agenda-span-to-ndays                                      1           1.609e-06     1.609e-06

[-- Attachment #3: elp-76cf2538.txt --]
[-- Type: text/plain, Size: 10425 bytes --]

org-agenda                                                    1           30.228317001  30.228317001
org-agenda-list                                               1           30.008787535  30.008787535
org-agenda-get-day-entries                                    14          29.660869816  2.1186335583
org-agenda-skip                                               813         28.515058474  0.0350738726
org-in-src-block-p                                            813         28.441751922  0.0349837047
org-agenda-get-scheduled                                      14          20.508218072  1.4648727194
org-agenda-get-deadlines                                      14          6.731387816   0.4808134154
org-agenda-get-blocks                                         14          2.0721020529  0.1480072894
org-entry-get                                                 589         0.4468897459  0.0007587262
org-get-property-block                                        589         0.421096625   0.0007149348
org-back-to-heading                                           1962        0.3602583869  0.0001836179
org-agenda-get-timestamps                                     14          0.262766359   0.0187690256
org-get-todo-state                                            773         0.2382924820  0.0003082697
org-agenda-get-restriction-and-command                        1           0.219454936   0.219454936
org-agenda-prepare                                            1           0.213265379   0.213265379
org-agenda-prepare-buffers                                    1           0.209496288   0.209496288
org-time-string-to-absolute                                   758         0.1317035409  0.0001737513
org-before-first-heading-p                                    589         0.1023915890  0.0001738397
org-agenda-finalize-entries                                   1           0.101975926   0.101975926
org-agenda-highlight-todo                                     45          0.0979822400  0.0021773831
org-refresh-category-properties                               14          0.0876999270  0.0062642805
org-agenda-get-sexps                                          14          0.0833151619  0.0059510829
org-get-tags-at                                               33          0.071930858   0.0021797229
org-up-heading-safe                                           124         0.0677388660  0.0005462811
org-end-of-subtree                                            83          0.0542820329  0.0006540003
org-agenda-format-item                                        45          0.0201687970  0.0004481954
org-agenda-quit                                               1           0.014157344   0.014157344
org-agenda-Quit                                               1           0.014141981   0.014141981
org-parse-time-string                                         836         0.0123557989  1.477...e-05
org-get-effort                                                34          0.0119257389  0.0003507570
org-get-priority                                              31          0.011187269   0.0003608796
org-outline-level                                             331         0.0110638410  3.342...e-05
org-agenda-finalize                                           1           0.006080879   0.006080879
org-agenda-align-tags                                         1           0.005008426   0.005008426
org-at-date-range-p                                           36          0.0049297940  0.0001369387
org-fit-window-to-buffer                                      1           0.004054615   0.004054615
org-backward-heading-same-level                               2           0.00360709    0.001803545
org-diary-sexp-entry                                          27          0.002955527   0.0001094639
org-switch-to-buffer-other-window                             1           0.002494355   0.002494355
org-agenda-files                                              3           0.0024815699  0.0008271899
org-agenda-add-time-grid-maybe                                1           0.002327298   0.002327298
org-closest-date                                              26          0.002321751   8.929...e-05
org-check-agenda-file                                         28          0.002206258   7.879...e-05
org-agenda-skip-eval                                          1624        0.0021658900  1.333...e-06
org-get-agenda-file-buffer                                    28          0.0018778790  6.706...e-05
org-agenda-mode                                               1           0.001808435   0.001808435
org-agenda-new-marker                                         64          0.0017705319  2.766...e-05
org-entries-lessp                                             166         0.0017693260  1.065...e-05
org-time-string-to-time                                       52          0.0016844940  3.239...e-05
org-trim                                                      87          0.001591569   1.829...e-05
org-find-base-buffer-visiting                                 28          0.001589439   5.676...e-05
org-add-props                                                 144         0.0012833470  8.912...e-06
org-agenda-todayp                                             29          0.0010528069  3.630...e-05
org-get-wdays                                                 191         0.0008695790  4.552...e-06
org-date-to-gregorian                                         52          0.0008140920  1.565...e-05
org-agenda-fix-displayed-tags                                 45          0.000784076   1.742...e-05
org-today                                                     30          0.0007081949  2.360...e-05
org-activate-plain-links                                      2           0.0006233829  0.0003116914
org-get-time-of-day                                           27          0.0004254750  1.575...e-05
org-remove-uninherited-tags                                   35          0.000382968   1.094...e-05
org-defkey                                                    38          0.0003686609  9.701...e-06
org-get-todo-face                                             31          0.000324218   1.045...e-05
org-split-string                                              30          0.000309698   1.032...e-05
org-uniquify                                                  6           0.000244711   4.078...e-05
org-downcase-keep-props                                       96          0.0002143959  2.233...e-06
org-get-category                                              34          0.000201463   5.925...e-06
org-activate-bracket-links                                    2           0.000198061   9.90305e-05
org-before-change-function                                    69          0.0001326749  1.922...e-06
org-agenda-fontify-priorities                                 1           0.000129385   0.000129385
org-agenda-prepare-window                                     1           0.000125497   0.000125497
org-float-time                                                64          0.000122079   1.907...e-06
org-days-to-iso-week                                          3           0.000115953   3.8651e-05
org-pop-to-buffer-same-window                                 1           0.000104088   0.000104088
org-agenda-get-category-icon                                  45          9.505...e-05  2.112...e-06
org-at-heading-p                                              2           8.8614e-05    4.4307e-05
org-compile-prefix-format                                     1           7.9135e-05    7.9135e-05
org-delete-all                                                35          7.736...e-05  2.210...e-06
org-agenda-reset-markers                                      3           7.661...e-05  2.553...e-05
org-reduced-level                                             33          7.402e-05     2.243...e-06
org-agenda-get-day-face                                       1           4.7447e-05    4.7447e-05
org-key                                                       38          4.4811e-05    1.179...e-06
org-face-from-face-or-color                                   31          4.3045e-05    1.388...e-06
org-file-menu-entry                                           14          3.2797e-05    2.342...e-06
org-remove-flyspell-overlays-in                               2           2.7152e-05    1.3576e-05
org-agenda-deadline-face                                      8           2.556...e-05  3.196...e-06
org-unhighlight                                               1           2.1398e-05    2.1398e-05
org-agenda-time-of-day-to-ampm-maybe                          12          1.6879e-05    1.406...e-06
org-add-hook                                                  3           1.5579e-05    5.193e-06
org-agenda-mark-header-line                                   1           1.403e-05     1.403e-05
org-contextualize-keys                                        1           1.2491e-05    1.2491e-05
org-get-at-bol                                                1           8.842e-06     8.842e-06
org-agenda-set-mode-name                                      1           7.674e-06     7.674e-06
org-detach-overlay                                            1           7.007e-06     7.007e-06
org-agenda-span-name                                          1           5.038e-06     5.038e-06
org-add-prop-inherited                                        2           4.416e-06     2.208e-06
org-agenda-mark-clocking-task                                 1           4.025e-06     4.025e-06
org-region-active-p                                           1           3.443e-06     3.443e-06
org-agenda-ndays-to-span                                      2           2.947e-06     1.4735e-06
org-agenda-update-agenda-type                                 1           2.882e-06     2.882e-06
org-agenda-fit-window-to-buffer                               1           2.195e-06     2.195e-06
org-font-lock-add-tag-faces                                   1           2.151e-06     2.151e-06
org-set-sorting-strategy                                      1           1.915e-06     1.915e-06
org-agenda-span-to-ndays                                      1           1.899e-06     1.899e-06
org-agenda-use-sticky-p                                       1           1.76e-06      1.76e-06

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

* Re: Dramatic slowdown in org mode
  2012-12-18 21:05 Dramatic slowdown in org mode Fraga, Eric
@ 2012-12-18 21:47 ` Abdó Roig-Maranges
  2012-12-18 23:26   ` Bastien
  2012-12-18 21:53 ` Bastien
  2012-12-18 23:26 ` Bastien
  2 siblings, 1 reply; 9+ messages in thread
From: Abdó Roig-Maranges @ 2012-12-18 21:47 UTC (permalink / raw)
  To: Fraga, Eric; +Cc: emacs-orgmode@gnu.org



Hi

> sometime between last week and today, there has been a dramatic
> slowdown in the generation of an agenda view.

I tracked it back to commit a7afe7d, but haven't had the time to
investigate it further. On my case the slowdown is not as dramatic as
Eric's, though.

Abdo.

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

* Re: Dramatic slowdown in org mode
  2012-12-18 21:05 Dramatic slowdown in org mode Fraga, Eric
  2012-12-18 21:47 ` Abdó Roig-Maranges
@ 2012-12-18 21:53 ` Bastien
  2012-12-18 22:52   ` Abdó Roig-Maranges
  2012-12-18 22:54   ` Nick Dokos
  2012-12-18 23:26 ` Bastien
  2 siblings, 2 replies; 9+ messages in thread
From: Bastien @ 2012-12-18 21:53 UTC (permalink / raw)
  To: Fraga, Eric; +Cc: emacs-orgmode@gnu.org

Hi Eric,

"Fraga, Eric" <e.fraga@ucl.ac.uk> writes:

> Unfortunately, I haven't had the chance to go through the changes over the
> past week to see if I could identify which one causes the dramatic change
> in performance.

My guess is commit 980e522 -- can you confirm this?

-- 
 Bastien

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

* Re: Dramatic slowdown in org mode
  2012-12-18 21:53 ` Bastien
@ 2012-12-18 22:52   ` Abdó Roig-Maranges
  2012-12-18 22:54   ` Nick Dokos
  1 sibling, 0 replies; 9+ messages in thread
From: Abdó Roig-Maranges @ 2012-12-18 22:52 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode@gnu.org


Hi,

> My guess is commit 980e522 -- can you confirm this?

I don't think it is 980e522. Here are my timings

a7afe7d:    10.6 s
c4bf1ee:    3.86 s

980e522:    3.8  s
08e4111:    3.88 s

that point to a7afe7d. It reads the files all right in about 4s, and on
the extra 6 seconds it just keeps thinking hard, until it displays the agenda.

Abdo.

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

* Re: Dramatic slowdown in org mode
  2012-12-18 21:53 ` Bastien
  2012-12-18 22:52   ` Abdó Roig-Maranges
@ 2012-12-18 22:54   ` Nick Dokos
  1 sibling, 0 replies; 9+ messages in thread
From: Nick Dokos @ 2012-12-18 22:54 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode@gnu.org

Bastien <bzg@altern.org> wrote:

> Hi Eric,
> 
> "Fraga, Eric" <e.fraga@ucl.ac.uk> writes:
> 
> > Unfortunately, I haven't had the chance to go through the changes over the
> > past week to see if I could identify which one causes the dramatic change
> > in performance.
> 
> My guess is commit 980e522 -- can you confirm this?
> 


I doubt it - this commit is not in the range that Eric identified (indirectly
in the filenames, so I'm guessing):

,----
| $ git log --oneline 47ea1666..76cf2538 
| 76cf253 Merge branch 'maint'
| 7739e8b Small refactoring
| 0f3264f org-agenda.el: Use `org-todo-keyword-faces' to highlight selected TODO keywords.
| 0db5f28 org-html.el and org-e-html.el: Add CSS classes to list tags.
| bbb451a Merge branch 'maint'
| 374efdd org.el (org-in-fixed-width-region-p): Rewrite using org-element.el.
| 4996e5b Merge branch 'maint'
| 9d4dd69 org.el (org-fill-paragraph): Fill correctly in source code block.
| 1af0b39 Allow C-S-<up/down> to sync update clock timestamps by several units.
| 709bf92 Backwards compatibility for `user-error´
| 676180a org-e-texinfo.el: Fix link export to account for alternate TOC names
| 83b5679 org-export: Fix docstring
| 442b2ad Merge branch 'maint'
| 20839ce org-element: Fix parsing of a list in a block in a list
| 4588244 Revert "tangled files should not be writable"
| 457c27d org-e-confluence: Add asynchronous export support
| fa0e8fe org-test.el (org-test-with-temp-text-in-file): Wrap ,@body into (progn ...).
| c8452bf Merge branch 'maint'
| c0675b4 test-org-src.el: Fix a test.
| 8f3b8ee testing/org-test.el: Fix `org-test-with-temp-text'.
| e77f26e contrib/lisp/org-e-confluence.el: New file by Sébastien Delafond
| 20940bb contrib/lisp/org-bullets.el: New file by Evgeni Sabof
| db5881f Merge branch 'master' of orgmode.org:org-mode
| beea46f Merge branch 'maint'
| 0b44eb6 Add doclicense.texi to include the GNU FDL license and fix the copyright notice.
| e556812 org-export: Fix docstring
| 68d4de2 org-koma-letter: Add asynchronous export support
| a223d1a * contrib/lisp/org-e-texinfo.el: Remove messages used for debugging (org-e-texinfo--generate-menu-items): Remove messages used for debugging.
| 2dbd84e Merge branch 'maint'
| 6f5b4a8 orgguide.texi: Fix the copyright notice.
| 6af6e95 Merge branch 'maint'
| cd24962 org.texi: Update copyright notice.
| db51b80 Merge branch 'maint'
| df09917 org.el (org-edit-special): Fix bug about editing special environments.
| 81d5ebc org-src.el (org-edit-src-code): Check if we are in a source code block with `org-in-src-block-p'.
| a7afe7d org.el (org-in-src-block-p): Return t when on #+BEGIN|END_SRC lines.
| b866204 Merge branch 'maint'
| c4bf1ee Remove gplmanual.pl as we are not allowed to dual-license the Org manual.
| 6202df5 Merge branch 'master' of orgmode.org:org-mode
| 2c164be Merge branch 'maint'
| 4524a02 Edit source: fix 'end' initialisation
| 22e4a4e Revert "org-src.el (org-edit-src-code): Fix bug on Emacs <24.1."
| 286fd7f org-e-beamer/html: Asynchronous export ignores `org-export-show-temporary-export-buffer'
| 26d2490 Merge branch 'maint'
| 0584dff ob-exp.el (obe-marker): Delete useless var.
| ac1b117 Merge branch 'maint'
| 70b0f42 Fix copyright notices for test files.
| a0cb4a3 add tests for org-src-edit
| f72bb57 Merge branch 'master' of orgmode.org:org-mode
| 22ee29b Merge branch 'maint'
| 7a770c1 org-src.el (org-edit-src-code): Fix bug on Emacs <24.1.
| 06872a4 export back-ends: Activate asynchronous export
| 5319cec org-e-publish: Activate asynchronous publishing
| ffb630b org-export: Add asynchronous process wrapper for export
| 5c1eab5 * contrib/lisp/org-e-texinfo.el: Provided export of info: links
| 31d24aa Merge branch 'maint'
| 82db0aa org.texi: Fix typos.
| 8c04fb7 org-exp.el (org-export-copy-to-kill-ring): Add a new choice 'if-interactive and use it as the default.
| 627d573 org-e-html: Small refactoring
| 2c39a4a export back-ends: Apply line break changes
| 6e37a4d org-element: Fix line break parsing
| 8dd3fa3 Use the org-mime-default-header customized variable
| 2c34715 option to byte-compile elisp loaded from Org files
| 5e3b825 tangled files should not be writable
| ff00818 requiring ob now pulls in all of Babel
| 0694965 renaming lisp/ob.el to lisp/ob-core.el
| ba59eeb ob-python: specify defcustom parameters
| 01bf706 org-babel: fix bug introduced in commit 78cdf149
| cf9838f org.el: Display the blocking heading when a TODO state change is blocked.
| 1bfea39 Support `C-1' prefix for `org-agenda-capture' and `org-capture'.
| 275f07c Merge branch 'maint'
| 488eea6 org-latex.el: Escape raw path when exporting links to files.
`----

a7afe7d was my initial guess because of the profiles:

org-in-src-block-p                                            813         0.0134103450  1.649...e-05

org-in-src-block-p                                            813         28.441751922  0.0349837047

That's a whopping difference for such a simple function.

Abdo Roig-Maranges apparently did a bisect and came to the same conclusion.

A simple profiling exercise with the two versions of the function indicates a big difference but
as Abdo indicated as well, not as big as Eric finds:

--8<---------------cut here---------------start------------->8---
(defun org-in-src-block1-p (&optional inside)
  "Whether point is in a code source block.
When INSIDE is non-nil, don't consider we are within a src block
when point is at #+BEGIN_SRC or #+END_SRC."
  (let (ov)
    (or (when (setq ov (overlays-at (point)))
	  (memq 'org-block-background
		(overlay-properties
		 (car ov))))
	(and (not inside)
	     (save-match-data
	       (save-excursion
		 (move-beginning-of-line 1)
		 (looking-at ".*#\\+\\(BEGIN\\|END\\)_SRC")))))))

(defun org-in-src-block2-p ()
  "Whether point is in a code source block."
  (let (ov)
    (when (setq ov (overlays-at (point)))
	  (memq 'org-block-background
		(overlay-properties
		 (car ov))))))

(defun my-test1 ()
  (let ((n 1000))
    (while (> n 0)
      (org-in-src-block1-p)
      (setq n (1- n)))))

(defun my-test2 ()
  (let ((n 1000))
    (while (> n 0)
      (org-in-src-block2-p)
      (setq n (1- n)))))
--8<---------------cut here---------------end--------------->8---

When executed on a begin_src line, my-test1 is 5x as slow as my-test2
in my setup. Otherwise the factor is about 2.

But Eric gets a factor of 2500 which is a bit of a mystery to me.
There might be additional factors entering in his case.

It's clear however that the regexp slows things down substantially.
BTW, do we really need the regexp to match anything before the
#+BEGIN_SRC, or just white space? If the latter is ok, it should speed
up the regexp matching.

Nick

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

* Re: Dramatic slowdown in org mode
  2012-12-18 21:47 ` Abdó Roig-Maranges
@ 2012-12-18 23:26   ` Bastien
  0 siblings, 0 replies; 9+ messages in thread
From: Bastien @ 2012-12-18 23:26 UTC (permalink / raw)
  To: Abdó Roig-Maranges; +Cc: emacs-orgmode@gnu.org

Hi Abdó,

Abdó Roig-Maranges <abdo.roig@gmail.com> writes:

> I tracked it back to commit a7afe7d, but haven't had the time to
> investigate it further. On my case the slowdown is not as dramatic as
> Eric's, though.

Thanks for the investigation.

The problem was that org-agenda-skip, which is called many times 
during agenda generation, checks whether the point is in a code
source block.  The new org-in-src-block-p distinguish whether 
we are really within or "at" (which includes the #+begin_src
and #+end_src lines).  org-agenda-skip just needs to check
if we are _within_.  I fixed this.

-- 
 Bastien

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

* Re: Dramatic slowdown in org mode
  2012-12-18 21:05 Dramatic slowdown in org mode Fraga, Eric
  2012-12-18 21:47 ` Abdó Roig-Maranges
  2012-12-18 21:53 ` Bastien
@ 2012-12-18 23:26 ` Bastien
  2012-12-19  6:25   ` Fraga, Eric
  2 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2012-12-18 23:26 UTC (permalink / raw)
  To: Fraga, Eric; +Cc: emacs-orgmode@gnu.org

Hi Eric,

"Fraga, Eric" <e.fraga@ucl.ac.uk> writes:

> sometime between last week and today, there has been a dramatic slowdown in
> the generation of an agenda view.  Using elp to instrument the org package
> and then asking for the default agenda view (C-c a a), I get the attached
> results.  The agenda view takes just under 2 seconds with org from commit
> 47ea1666 (12 December) and over 30 seconds with org from commit 76cf2538
> (today, up to date).  I have attached the two outputs from elp.

This should be fixed -- let me know if the problem persists.

Thanks,

-- 
 Bastien

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

* Re: Dramatic slowdown in org mode
  2012-12-18 23:26 ` Bastien
@ 2012-12-19  6:25   ` Fraga, Eric
  2012-12-19  9:42     ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Fraga, Eric @ 2012-12-19  6:25 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode@gnu.org

> From: Bastien Guerry [bastienguerry@gmail.com] on behalf of Bastien [bzg@altern.org]
> "Fraga, Eric" <e.fraga@ucl.ac.uk> writes:
> 
> > sometime between last week and today, there has been a dramatic slowdown in
> > the generation of an agenda view.  Using elp to instrument the org package
> > and then asking for the default agenda view (C-c a a), I get the attached
> > results.  The agenda view takes just under 2 seconds with org from commit
> > 47ea1666 (12 December) and over 30 seconds with org from commit 76cf2538
> > (today, up to date).  I have attached the two outputs from elp.
> 
> This should be fixed -- let me know if the problem persists.

Bastien,

this has definitely been fixed!  Thank you very much.

And thanks to everybody else that investigated while I slept ;-)  I am completely jet-lagged (after 30+ hour trip from Oz to UK)...

eric

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

* Re: Dramatic slowdown in org mode
  2012-12-19  6:25   ` Fraga, Eric
@ 2012-12-19  9:42     ` Bastien
  0 siblings, 0 replies; 9+ messages in thread
From: Bastien @ 2012-12-19  9:42 UTC (permalink / raw)
  To: Fraga, Eric; +Cc: emacs-orgmode@gnu.org

"Fraga, Eric" <e.fraga@ucl.ac.uk> writes:

> this has definitely been fixed!  Thank you very much.

Thanks for confirming!

-- 
 Bastien

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

end of thread, other threads:[~2012-12-19  9:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-18 21:05 Dramatic slowdown in org mode Fraga, Eric
2012-12-18 21:47 ` Abdó Roig-Maranges
2012-12-18 23:26   ` Bastien
2012-12-18 21:53 ` Bastien
2012-12-18 22:52   ` Abdó Roig-Maranges
2012-12-18 22:54   ` Nick Dokos
2012-12-18 23:26 ` Bastien
2012-12-19  6:25   ` Fraga, Eric
2012-12-19  9:42     ` Bastien

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).