Re: [Orgmode] org-shifmetadown/up are slow

2009-08-02 Thread Carsten Dominik

Hi Samuel,

On Jul 8, 2009, at 7:07 AM, Samuel Wales wrote:


I think that some of this is slow for inherent emacs reasons.  Simply
doing down arrow can sometimes be slow.


Yes, if there is *lots* of hidden text the cursor has to jump over.


However, moving subtrees is
very slow.  Dp you think it's mostly outline-mode?  Is it possible to
defsubst after the fact?


Please pull from git, this problem should have disappeared,
I simplified the cleanup of the display after moving a subtree
which became *very* expensive for entries with very many siblings.
So the reason was Org in a way, but the reason why this operation
was slow is because outline functions used are slow.

What I have done now as well is advising outline-end-of-subtree
to use my own version when in Org-mode, so that any outline commands
using it will now be much faster.

The reason why outline functions are so extremely slow for some
operations are:

- they have been written in full generality, with possibly weird
  strings as outline headings, so they need to find each and every
  heading and compute the outline level.  Org, on the other hand,
  knows that the headline level is directly given by the number
  of stars and can directly search for the right kind of heading
  that will terminate the subtree.

- Outline functions have been written with book-like structure
  in mind, i.e. with a limited number of nodes.  Large and deep
  lists as we have them will cause this code to perform badly.

HTH

- Carsten



Thanks.

On Mon, Jun 22, 2009 at 11:43, Samuel Walessamolog...@gmail.com  
wrote:
On Sun, Jun 21, 2009 at 22:41, Carsten Dominikcarsten.domi...@gmail.com 
 wrote:

could you please re-run these tests, and instrument for elp not
only org, but also the entire outline package?  Seems to me that
much of this time is spent in a non-org function.


Function Name Call
Count  Elapsed Time  Average Time

==    
org-move-subtree-down 97
  213.6198742.2022667422
org-compact-display-after-subtree-move96
  203.12814400  2.1159181666
outline-end-of-subtree392
  156.43101299  0.3990587066
outline-next-heading  1925977
  139.79470300  7.258...e-05
outline-flag-subtree  104
  114.38383400  1.0998445576
org-shiftmetadown 51
  109.8186612.1533070784
org-shiftmetaup   46
  103.8374252.2573353260
org-move-subtree-up   46
  103.8218312.2569963260
outline-map-region191
  40.191857999  0.2104285759
org-outline-level 1905188
  25.819659000  1.355...e-05
org-cycle-hide-drawers183
  11.270871000  0.0615894590
org-flag-drawer   29066
  5.470356  0.0001882046
outline-next-visible-heading  386
  4.221285  0.0109359740
outline-get-last-sibling  46
  2.634253  0.0572663695
outline-previous-visible-heading  335
  2.611866  0.0077966179
org-shiftmetaright8
  2.308401  0.2885501250
org-up-heading-safe   192
  2.15  0.0111979166
org-end-of-subtree234
  1.946635  0.0083189572
outline-get-next-sibling  51
  1.620701  0.0317784705
outline-flag-region   30978
  1.493255  4.820...e-05
org-show-empty-lines-in-parent96
  1.132384  0.011795
outline-up-heading8
  0.335284  0.0419105
outline-previous-heading  6570
  0.222915  3.392...e-05
outline-show-heading  1241
  0.092440  7.448...e-05
outline-back-to-heading   1624
  0.066418  4.089...e-05
org-mouse-down-mouse  1
  0.063905  0.063905
outline-end-of-heading1634
  0.063265  3.871...e-05
outline-on-heading-p  1903
  0.059133  3.107...e-05
org-back-over-empty-lines 341
  0.057222  0.0001678064
org-save-markers-in-region96
  0.042984  0.0004477604
org-cycle-show-empty-lines192
  0.041974  0.0002186197

Re: [Orgmode] org-shifmetadown/up are slow

2009-07-07 Thread Samuel Wales
I think that some of this is slow for inherent emacs reasons.  Simply
doing down arrow can sometimes be slow.  However, moving subtrees is
very slow.  Dp you think it's mostly outline-mode?  Is it possible to
defsubst after the fact?

Thanks.

On Mon, Jun 22, 2009 at 11:43, Samuel Walessamolog...@gmail.com wrote:
 On Sun, Jun 21, 2009 at 22:41, Carsten Dominikcarsten.domi...@gmail.com 
 wrote:
 could you please re-run these tests, and instrument for elp not
 only org, but also the entire outline package?  Seems to me that
 much of this time is spent in a non-org function.

 Function Name                                                 Call
 Count  Elapsed Time  Average Time
 
 ==    
 org-move-subtree-down                                         97
   213.619874    2.2022667422
 org-compact-display-after-subtree-move                        96
   203.12814400  2.1159181666
 outline-end-of-subtree                                        392
   156.43101299  0.3990587066
 outline-next-heading                                          1925977
   139.79470300  7.258...e-05
 outline-flag-subtree                                          104
   114.38383400  1.0998445576
 org-shiftmetadown                                             51
   109.818661    2.1533070784
 org-shiftmetaup                                               46
   103.837425    2.2573353260
 org-move-subtree-up                                           46
   103.821831    2.2569963260
 outline-map-region                                            191
   40.191857999  0.2104285759
 org-outline-level                                             1905188
   25.819659000  1.355...e-05
 org-cycle-hide-drawers                                        183
   11.270871000  0.0615894590
 org-flag-drawer                                               29066
   5.470356  0.0001882046
 outline-next-visible-heading                                  386
   4.221285  0.0109359740
 outline-get-last-sibling                                      46
   2.634253      0.0572663695
 outline-previous-visible-heading                              335
   2.611866  0.0077966179
 org-shiftmetaright                                            8
   2.308401  0.2885501250
 org-up-heading-safe                                           192
   2.15  0.0111979166
 org-end-of-subtree                                            234
   1.946635  0.0083189572
 outline-get-next-sibling                                      51
   1.620701  0.0317784705
 outline-flag-region                                           30978
   1.493255  4.820...e-05
 org-show-empty-lines-in-parent                                96
   1.132384      0.011795
 outline-up-heading                                            8
   0.335284      0.0419105
 outline-previous-heading                                      6570
   0.222915  3.392...e-05
 outline-show-heading                                          1241
   0.092440  7.448...e-05
 outline-back-to-heading                                       1624
   0.066418  4.089...e-05
 org-mouse-down-mouse                                          1
   0.063905      0.063905
 outline-end-of-heading                                        1634
   0.063265  3.871...e-05
 outline-on-heading-p                                          1903
   0.059133  3.107...e-05
 org-back-over-empty-lines                                     341
   0.057222  0.0001678064
 org-save-markers-in-region                                    96
   0.042984  0.0004477604
 org-cycle-show-empty-lines                                    192
   0.041974  0.0002186197
 org-back-to-heading                                           642
   0.035574  5.541...e-05
 org-agenda-save-markers-for-cut-and-paste                     96
   0.035326      0.0003679791
 org-do-emphasis-faces                                         197
   0.034992  0.0001776294
 org-first-sibling-p                                           96
   0.034133      0.000320
 org-map-tree                                                  16
   0.029704  0.0018565624
 org-show-entry                                                87
   0.028294  0.0003252298
 org-at-table-p                                                113
   0.023057  0.0002040530
 org-activate-tags                                             310
   0.021770  7.022...e-05
 org-shiftmetaleft                                             8
   0.020002  0.0025003749
 org-activate-footnote-links                                   196
   0.018426  9.401...e-05
 org-set-tags                                                  16
   0.017575  0.0010984999
 org-demote-subtree                                            8
   0.017286      0.00216075
 org-promote-subtree                                       

Re: [Orgmode] org-shifmetadown/up are slow

2009-06-22 Thread Samuel Wales
On Sun, Jun 21, 2009 at 22:41, Carsten Dominikcarsten.domi...@gmail.com wrote:
 could you please re-run these tests, and instrument for elp not
 only org, but also the entire outline package?  Seems to me that
 much of this time is spent in a non-org function.

Function Name Call
Count  Elapsed Time  Average Time

==    
org-move-subtree-down 97
   213.6198742.2022667422
org-compact-display-after-subtree-move96
   203.12814400  2.1159181666
outline-end-of-subtree392
   156.43101299  0.3990587066
outline-next-heading  1925977
   139.79470300  7.258...e-05
outline-flag-subtree  104
   114.38383400  1.0998445576
org-shiftmetadown 51
   109.8186612.1533070784
org-shiftmetaup   46
   103.8374252.2573353260
org-move-subtree-up   46
   103.8218312.2569963260
outline-map-region191
   40.191857999  0.2104285759
org-outline-level 1905188
   25.819659000  1.355...e-05
org-cycle-hide-drawers183
   11.270871000  0.0615894590
org-flag-drawer   29066
   5.470356  0.0001882046
outline-next-visible-heading  386
   4.221285  0.0109359740
outline-get-last-sibling  46
   2.634253  0.0572663695
outline-previous-visible-heading  335
   2.611866  0.0077966179
org-shiftmetaright8
   2.308401  0.2885501250
org-up-heading-safe   192
   2.15  0.0111979166
org-end-of-subtree234
   1.946635  0.0083189572
outline-get-next-sibling  51
   1.620701  0.0317784705
outline-flag-region   30978
   1.493255  4.820...e-05
org-show-empty-lines-in-parent96
   1.132384  0.011795
outline-up-heading8
   0.335284  0.0419105
outline-previous-heading  6570
   0.222915  3.392...e-05
outline-show-heading  1241
   0.092440  7.448...e-05
outline-back-to-heading   1624
   0.066418  4.089...e-05
org-mouse-down-mouse  1
   0.063905  0.063905
outline-end-of-heading1634
   0.063265  3.871...e-05
outline-on-heading-p  1903
   0.059133  3.107...e-05
org-back-over-empty-lines 341
   0.057222  0.0001678064
org-save-markers-in-region96
   0.042984  0.0004477604
org-cycle-show-empty-lines192
   0.041974  0.0002186197
org-back-to-heading   642
   0.035574  5.541...e-05
org-agenda-save-markers-for-cut-and-paste 96
   0.035326  0.0003679791
org-do-emphasis-faces 197
   0.034992  0.0001776294
org-first-sibling-p   96
   0.034133  0.000320
org-map-tree  16
   0.029704  0.0018565624
org-show-entry87
   0.028294  0.0003252298
org-at-table-p113
   0.023057  0.0002040530
org-activate-tags 310
   0.021770  7.022...e-05
org-shiftmetaleft 8
   0.020002  0.0025003749
org-activate-footnote-links   196
   0.018426  9.401...e-05
org-set-tags  16
   0.017575  0.0010984999
org-demote-subtree8
   0.017286  0.00216075
org-promote-subtree   8
   0.015923  0.001990375
org-on-heading-p  129
   0.015623  0.0001211162
org-activate-plain-links  311
   0.015291  4.917...e-05
org-demote8
   0.013538  0.0016923749
org-promote  

[Orgmode] org-shifmetadown/up are slow

2009-06-21 Thread Samuel Wales
I frequently rearrange headlines with org-shiftmetadown/up.  It is
faster (in the human sense) than kill and yank or refile if the place
I want to put them is underneath a sibling.

However, it is sometimes slow, taking a second or two per command.
This occurs when there are large trees around.

Is this something that can be sped up, or is that impossible?

Here is a profile generated with mostly medium-sized trees (I will
have about thrice that size in some cases) in case it helps.

I did elp-insrument package org then a bunch of the relevant
operations then elp-results.  Please tell me if there are better ways
to profile.

Thanks.


Function Name Call
Count  Elapsed Time  Average Time

==    
org-move-subtree-down 26
   14.905667 0.5732948846
org-compact-display-after-subtree-move26
   13.594199000  0.5228538076
org-shiftmetaup   13
   8.523098  0.6556229230
org-move-subtree-up   13
   8.518649  0.6552806923
org-shiftmetadown 13
   6.39124   0.4916338461
org-outline-level 215586
   2.851335  1.322...e-05
org-cycle 2
   1.302404  0.651202
org-cycle-internal-local  2
   1.301338  0.650669
org-cycle-hide-drawers54
   1.295570  0.0239920370
org-shiftmetaright2
   0.694777  0.3473885
org-flag-drawer   4154
   0.562664  0.0001354511
org-up-heading-safe   52
   0.543978  0.0104611153
org-end-of-subtree70
   0.322521  0.0046074428
org-show-empty-lines-in-parent26
   0.280831  0.0108011923
org-map-tree  4
   0.169852  0.042463
org-demote-subtree2
   0.086123  0.0430615
org-shiftmetaleft 2
   0.08543   0.042715
org-promote-subtree   2
   0.084803  0.0424015
org-set-tags  360
   0.084661  0.0002351722
org-demote180
   0.075852  0.0004214055
org-promote   180
   0.073965  0.0004109166
org-get-tags-string   360
   0.024398  6.7775e-05
org-move-to-column360
   0.021485  5.968...e-05
org-optimize-window-after-visibility-change   2
   0.017915  0.0089575
org-subtree-end-visible-p 1
   0.017782  0.017782
org-cycle-hide-archived-subtrees  2
   0.01267   0.006335
org-get-string-indentation2187
   0.011260  5.148...e-06
org-on-heading-p  390
   0.011237  2.881...e-05
org-activate-tags 122
   0.010786  8.840...e-05
org-back-to-heading   543
   0.009370  1.725...e-05
org-cycle-show-empty-lines54
   0.007597  0.0001407037
org-back-over-empty-lines 91
   0.007464  8.202...e-05
org-first-sibling-p   26
   0.007216  0.0002775769
org-do-emphasis-faces 73
   0.007172  9.824...e-05
org-activate-footnote-links   71
   0.005473  7.709...e-05
org-at-table-p32
   0.005178  0.0001618125
org-activate-plain-links  113
   0.004861  4.302...e-05
org-fontify-meta-lines-and-blocks 71
   0.004194  5.908...e-05
org-show-entry27
   0.004002  0.000148
org-activate-dates112
   0.003513  3.1375e-05
org-font-lock-add-tag-faces   71
   0.003265  4.598...e-05
org-save-markers-in-region26
   0.002781  0.0001069615
org-activate-bracket-links83
   0.002632  3.171...e-05
org-unfontify-region  71
   0.002048  2.885...e-05