Re: [O] How to improve Org startup time?

2013-02-14 Thread Tassilo Horn
Sebastien Vauban
wxhgmqzgw...@spammotel.com writes:

 But then org-agenda-to-appt will be called each time your generate
 a new agenda... not sure you really want this right.

 Why not simply calling it interactively when you need it?

 I can't count on myself to do it at a regular enough interval (at least
 daily).

 Then, this is the only (?) solution found so that the appt-list is
 still quite up-to-date.

I call it once at emacs startup and then only when I save an agenda
file.

--8---cut here---start-8---
(defun th-org-agenda-to-appt ()
  (org-agenda-to-appt t)
  (appt-activate 1))

(defun th-org-mode-init ()
  ;; ...
  (when (and (org-agenda-file-p)
 (not (string= (file-name-nondirectory (buffer-file-name))
   org-mobile-capture-file))
 (not (string= (buffer-file-name)
   org-mobile-inbox-for-pull)))
(add-hook 'after-save-hook 'th-org-agenda-to-appt t t)))

(add-hook 'org-mode-hook 'th-org-mode-init)
--8---cut here---end---8---

Bye,
Tassilo




Re: [O] How to improve Org startup time?

2013-02-14 Thread Sebastien Vauban
Hi Tassilo,

Tassilo Horn wrote:
 Sebastien Vauban writes:

 But then org-agenda-to-appt will be called each time your generate a new
 agenda... not sure you really want this right.

 Why not simply calling it interactively when you need it?

 I can't count on myself to do it at a regular enough interval (at least
 daily).

 Then, this is the only (?) solution found so that the appt-list is still
 quite up-to-date.

 I call it once at emacs startup

I don't do it anymore, for not requiring Org libraries anymore, would I simply
fire up an Emacs for non-Org tasks (such as reading my mails with Gnus).

 and then only when I save an agenda file.

Pretty smart alternative (instead of doing it at every agenda build)...

 (defun th-org-agenda-to-appt ()
   (org-agenda-to-appt t)
   (appt-activate 1))

Why re-activating appt each time?  Why not simply once in your .emacs?

 (defun th-org-mode-init ()
   ;; ...
   (when (and (org-agenda-file-p)
(not (string= (file-name-nondirectory (buffer-file-name))
  org-mobile-capture-file))
(not (string= (buffer-file-name)
  org-mobile-inbox-for-pull)))
 (add-hook 'after-save-hook 'th-org-agenda-to-appt t t)))

 (add-hook 'org-mode-hook 'th-org-mode-init)

*I* don't understand why you put the addition to `after-save-hook' inside a
complex when about some type of file. Your `after-save-hook' is global, right?

Would something like the following not be sufficient -- eventually put in an
`(eval-after-load org)'...?

#+begin_src emacs-lisp
  (add-hook 'after-save-hook
(lambda ()
  (when (and (eq major-mode 'org-mode)
 (org-agenda-file-p))
(org-agenda-to-appt
#+end_src

Best regards,
  Seb

--
Sebastien Vauban




Re: [O] How to improve Org startup time?

2013-02-14 Thread Memnon Anon
Sebastien Vauban
wxhgmqzgw...@spammotel.com writes:
 Bastien wrote:
 Sebastien Vauban writes:

 However, I've left it in the `org-finalize-agenda-hook' hook, so that the
 `appt-list' is fed up as soon as I begin using agenda functions.

 But then org-agenda-to-appt will be called each time your generate
 a new agenda... not sure you really want this right.

 Why not simply calling it interactively when you need it?

 I can't count on myself to do it at a regular enough interval (at least
 daily).

 Then, this is the only (?) solution found so that the appt-list is still quite
 up-to-date.

I am using the same setup (thanks Bernt :):
- Initialize on Startup
- Update on midnight for next day with run-at-time
- Update frequently via org-finalize-agenda-hook

The last piece eats up quite some time (couple of seconds on my ancient
machine), so what about a different solution just for the last bit. 
E.g., updating, when an item gets scheduled/timestamped for today.

Something like (pseudo code!):

(defadvice org-schedule (after my-adv-update-appt activate)
  org-agenda-to-appt when org-last-timestamp todayp
  (when (= (time-to-days 
 (org-time-string-to-time org-last-inserted-timestamp))
(org-today))

(message Updating appt!)
(org-agenda-to-appt)))

(defadvice org-time-stamp (after my-adv-update-appt activate)
  org-agenda-to-appt when org-last-timestamp todayp
  (when (= (time-to-days 
 (org-time-string-to-time org-last-inserted-timestamp))
(org-today))

(message Updating appt!)
(org-agenda-to-appt)))

Would that work?
I agree, calling it interactively feels error prone and I would probably
forget it ... 

Memnon




Re: [O] How to improve Org startup time?

2013-02-14 Thread Sebastien Vauban
Hi Memnon,

Memnon Anon wrote:
 Sebastien Vauban writes:
 Bastien wrote:
 Sebastien Vauban writes:

 However, I've left it in the `org-finalize-agenda-hook' hook, so that the
 `appt-list' is fed up as soon as I begin using agenda functions.

 But then org-agenda-to-appt will be called each time your generate
 a new agenda... not sure you really want this right.

 Why not simply calling it interactively when you need it?

 I can't count on myself to do it at a regular enough interval (at least
 daily).

 Then, this is the only (?) solution found so that the appt-list is still 
 quite
 up-to-date.

 I am using the same setup (thanks Bernt :):
 - Initialize on Startup
 - Update on midnight for next day with run-at-time
 - Update frequently via org-finalize-agenda-hook

 The last piece eats up quite some time (couple of seconds on my ancient
 machine), so what about a different solution just for the last bit.

That's another way of thinking out of the box.

 E.g., updating, when an item gets scheduled/timestamped for today.

 Something like (pseudo code!):

 (defadvice org-schedule (after my-adv-update-appt activate)
   org-agenda-to-appt when org-last-timestamp todayp
   (when (= (time-to-days 
(org-time-string-to-time org-last-inserted-timestamp))
   (org-today))

 (message Updating appt!)
 (org-agenda-to-appt)))

 (defadvice org-time-stamp (after my-adv-update-appt activate)
   org-agenda-to-appt when org-last-timestamp todayp
   (when (= (time-to-days 
(org-time-string-to-time org-last-inserted-timestamp))
   (org-today))

 (message Updating appt!)
 (org-agenda-to-appt)))

 Would that work?
 I agree, calling it interactively feels error prone and I would probably
 forget it ...

Not in my habits, as I more often use S-up than C-c C-s. OK, one could argue
that if I move a timestamp from one day (or more), there is certainly no hours
attached to it. Rigth. But a bit fragile.

In fact, not in general, as it happens sometimes that I type the keyword
SCHEDULED by hand.

And, in fact, your code would be called (much) more often than if the
org-agenda-to-appt is called when saving an Org agenda file, what was the
solution of Tassilo. Do you see drawbacks in his solution?

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] How to improve Org startup time?

2013-01-31 Thread Sebastien Vauban
Hi Eric,

Eric S Fraga wrote:
 Sebastien Vauban wxhgmqzgw...@spammotel.com writes:
 Please find here an enriched log of the packages which are loaded for Org, 
 and
 the time it takes.

 [2013-01-29 21:20:18] (info) +- Requiring `appt'...
 [2013-01-29 21:20:18] (info)   +- Requiring `diary-lib'...
 [2013-01-29 21:20:18] (info) +- Requiring `calendar'...

 how do you get this output?  It looks very useful!

The timestamp stuff comes from EmacsWiki:

#+begin_src emacs-lisp
  (defadvice message (before when-was-that activate)
Add timestamps to `message' output.
(ad-set-arg 0 (concat (format-time-string [%Y-%m-%d %T] )
  (ad-get-arg 0
#+end_src

The call tree between packages is originally written by me:

#+begin_src emacs-lisp
  (defadvice require (around require-around activate)
Leave a trace of packages being loaded.
(let* ((feature (ad-get-arg 0))
   (require-depth (or (and (boundp 'require-depth) require-depth)
  0))
   (prefix (concat (make-string (* 2 require-depth) ? ) +- )))
  (cond ((featurep feature)
 (message (info) %sRequiring `%s'... already loaded
  prefix feature)
 ;; in the case `ad-do-it' is not called, you have to set the
 ;; return value yourself!
 (setq ad-return-value feature))
(t
 (let ((lvn/time-start))
   (message (info) %sRequiring `%s'... prefix feature)
   (setq lvn/time-start (float-time))
   (let ((require-depth (1+ require-depth)))
 ad-do-it)
   (message (info) %sRequiring `%s'... %s (loaded in %.2f s)
prefix feature
(locate-library (symbol-name feature))
(- (float-time) lvn/time-start)))
#+end_src

You can further improve what you see in the echo area with:

#+begin_src emacs-lisp
  (defadvice load (before debug-log activate)
(message (info) Loading %s... (locate-library (ad-get-arg 0

  (defadvice load-library (before debug-log activate)
(message (info) Loading library `%s'... (locate-library (ad-get-arg 0

  (defadvice load-file (before debug-log activate)
(message (info) Loading file `%s'... (locate-library (ad-get-arg 0

  (defadvice find-file (around find-file-around activate)
Open FILENAME and report time spent.
(let ((filename (ad-get-arg 0))
  (find-file-time-start (float-time)))
  (message (info) Finding file %s... filename)
  ad-do-it
  (message (info) Found file %s in %.2f s. filename
   (- (float-time) find-file-time-start
#+end_src

Adapt it to your taste (and report it!)...

 In terms of the actual topic of this thread, I can say that the recent
 changes to org for startup have led to a significant decrease in my
 emacs startup time.  Thanks to all that have done this!

I hope to benefit from all that soon, as well...

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] How to improve Org startup time?

2013-01-31 Thread Sebastien Vauban
Hi Eric,

Eric S Fraga wrote:
 Some timings on a 3-4 (?) year old netbook with Intel N450 Atom @1.66GHz
 dual core powered:

 With old org, actually from October 2012 (!) as this system acts as a
 cloud server for me so I don't actually use it interactively much:

 | org-agenda-to-appt |   1 | 12.525722775  | 12.525722775  |
 | org-agenda-prepare-buffers |   2 | 10.719484861  |  5.3597424305 |
 | org-agenda-get-day-entries |  15 |  1.4113181819 |  0.0940878787 |
 | org-agenda-get-scheduled   |  15 |  1.032943071  |  0.0688628714 |
 | org-agenda-get-deadlines   |  14 |  0.2688785840 |  0.0192056131 |
 | org-agenda-skip| 797 |  0.1879489969 |  0.0002358205 |

 and with up to date org as of a few minutes ago:

 | org-agenda-to-appt |   1 | 9.168879079  | 9.168879079  |
 | org-agenda-prepare-buffers |   2 | 8.1717637810 | 4.0858818905 |
 | org-agenda-get-day-entries |  15 | 0.5261351449 | 0.0350756763 |
 | org-agenda-get-deadlines   |  14 | 0.253867925  | 0.0181334232 |
 | org-agenda-get-scheduled   |  15 | 0.1835072029 | 0.0122338135 |
 | org-agenda-skip| 797 | 0.0482942050 | 6.059...e-05 |

 I.e. an approximately 25% reduction in time overall so I think
 org-agenda is significantly faster (okay, not orders of magnitude) but
 the time taken is dominated by org-agenda-prepare-buffers on this
 system.

 However, more interestingly, on a 1 year old desktop computer Intel Core
 i5-2500 @ 3.30 GHz, I get very different behaviour:

 | org-agenda-to-appt |   1 | 0.182718048  | 0.182718048  |
 | org-agenda-get-day-entries |  14 | 0.095832824  | 0.0068452017 |
 | org-agenda-prepare-buffers |   1 | 0.086104933  | 0.086104933  |
 | org-agenda-get-scheduled   |  14 | 0.067475949  | 0.0048197106 |
 | org-agenda-skip| 794 | 0.0475198030 | 5.984...e-05 |
 | org-agenda-get-deadlines   |  14 | 0.014998552  | 0.0010713251 |

 Notice the big change in org-agenda-prepare-buffers relative to the
 other calls.  Disk performance is almost likely the key here and I think
 the recent improvements are quite dramatic but I haven't had a chance to
 time these yet.

Dividing the figures by 50, just for the disks, seems too big for me, nope?

Just to be sure: are you sure that, in this last test, `org-agenda-to-appt'
was called without having first opening the agenda files?

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] How to improve Org startup time?

2013-01-31 Thread Sebastien Vauban
Bastien,

Sebastien Vauban wrote:
 Bastien wrote:
 put your .emacs on diet :) More seriously, I would start by checking
 org-agenda-to-appt documentation. It should be on your system. If it is not,
 check online.

 I tried to filter to only timestamp entries with the following:

 #+begin_src emacs-lisp
   (org-agenda-to-appt nil nil '(:timestamp))
 #+end_src

 But that does not work -- no error, but no event added to the appt list!

 I must not understand the rest parameter, I guess.

 That's what really slows down your config.

 Yes and no.

 Yes, because it's currently run at startup time, even if I put that command
 inside an eval-after-load org-agenda (as `org-agenda' is ultimately called
 when `org-clock-persist' is set).

 No, because no running that does not change the fact that, sooner or later,
 the Org agenda files will have to be loaded and scanned through.

 Not having that done at startup simply _add_ another 16 seconds delay to the
 computation of the first agenda view; not a gain IMO.

To be coherent with what I'm telling in this thread... that is:

- we can use Org just for note-taking, and exporting to HTML/LaTeX/etc.
- we can use it for agenda purpose only
- we can use if for clocking purpose only
- we can use it for any mix of these (at different moments in time)

... I've removed the explicit call of `(org-agenda-to-appt)' from my .emacs:
it makes no sense to search for event notifications at startup time if my
primary purpose, now, of firing up Emacs is to work on notes and documents.

However, I've left it in the `org-finalize-agenda-hook' hook, so that the
`appt-list' is fed up as soon as I begin using agenda functions.

That way, I have well removed 16 seconds from my Emacs startup time, but
they're moved for the creation of the _first_ agenda view.

IOW, the time is lost where it makes more sense, but I still have to search on
how to reduce that time.

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] How to improve Org startup time?

2013-01-31 Thread Bastien


Hi Sébastien,

Sebastien Vauban
wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org writes:

 #+begin_src emacs-lisp
   (org-agenda-to-appt nil nil '(:timestamp))
 #+end_src

Try this:

#+begin_src emacs-lisp
  (org-agenda-to-appt nil nil :timestamp)
#+end_src

HTH,

-- 
 Bastien




Re: [O] How to improve Org startup time?

2013-01-31 Thread Bastien


Hi Sébastien,

Sebastien Vauban
wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org writes:

 For example, why do all the Org agenda files have to be loaded when I'm simply
 opening a plain common (I mean: not part of the agenda) Org file?

They don't.  Can you reproduce the problem with a minimal config?

Thanks,

-- 
 Bastien




Re: [O] How to improve Org startup time?

2013-01-31 Thread Achim Gratz
Sebastien Vauban writes:
 You may be right, but I guess that I'm not alone using Windows 8, so my
 performance observations must be shared by others as well. It may even be
 worse for some who have more Org files, and a less powerful computer.

Take Emacs and Org out of the picture and check how fast you can open
random files.  That will tell you if the performance degradation you see
is caused (at least in part) by those low-level operations.  I've had
two incidents the past year where some group policy changes done by IT
would result in a file-open time of close to two seconds (no joke).  Now
imagine what happens when you need to open some 10k files…

As to how Org implements its agenda operations: I don't know and I don't
have a comment.


Regards,
Achim.
-- 
+[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+

Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds




Re: [O] How to improve Org startup time?

2013-01-31 Thread Bastien


Sebastien Vauban
wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org writes:

 However, I've left it in the `org-finalize-agenda-hook' hook, so that the
 `appt-list' is fed up as soon as I begin using agenda functions.

But then org-agenda-to-appt will be called each time your generate
a new agenda... not sure you really want this right.

Why not simply calling it interactively when you need it?

-- 
 Bastien




Re: [O] How to improve Org startup time?

2013-01-31 Thread Sebastien Vauban
Bastien,

Bastien wrote:
 Sebastien Vauban writes:

 However, I've left it in the `org-finalize-agenda-hook' hook, so that the
 `appt-list' is fed up as soon as I begin using agenda functions.

 But then org-agenda-to-appt will be called each time your generate
 a new agenda... not sure you really want this right.

 Why not simply calling it interactively when you need it?

I can't count on myself to do it at a regular enough interval (at least
daily).

Then, this is the only (?) solution found so that the appt-list is still quite
up-to-date.

This is how Bernt does it as well in his tutorial:

  http://doc.norang.ca/org-mode.html#Reminders

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] How to improve Org startup time?

2013-01-31 Thread Eric S Fraga
Sebastien Vauban wxhgmqzgw...@spammotel.com writes:

 The timestamp stuff comes from EmacsWiki:

 #+begin_src emacs-lisp
   (defadvice message (before when-was-that activate)
 Add timestamps to `message' output.
 (ad-set-arg 0 (concat (format-time-string [%Y-%m-%d %T] )
   (ad-get-arg 0
 #+end_src

 The call tree between packages is originally written by me:
 [...]

Thanks!  Very useful.
-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3d-917-gb9c506




Re: [O] How to improve Org startup time?

2013-01-31 Thread Eric S Fraga
Sebastien Vauban wxhgmqzgw...@spammotel.com writes:

 Hi Eric,


[...]

 Dividing the figures by 50, just for the disks, seems too big for me, nope?

Hi Seb, yes, it does seem dramatic.

 Just to be sure: are you sure that, in this last test, `org-agenda-to-appt'
 was called without having first opening the agenda files?

Ummm, I thought I was sure but I have just done it again and get
different results so I must have done something wrong in the last
test.  Ooops...  Doing it again, using this procedure:

- start emacs
- M-x elp-instrument-package RET org-agenda RET
- M-x org-agenda-to-apt RET
- M-x elp-results
- quit emacs

now gives me

| org-agenda-to-appt |   1 |  1.602924479 |  1.602924479 |
| org-agenda-prepare-buffers |   1 |  1.510812568 |  1.510812568 |
| org-agenda-get-day-entries |  14 |  0.088741138 | 0.0063386527 |
| org-agenda-get-scheduled   |  14 |  0.027990309 | 0.0019993077 |
| org-agenda-get-deadlines   |  14 | 0.0154423710 | 0.0011030265 |
| org-agenda-skip| 797 |  0.008103603 | 1.016...e-05 |

so the reduction is not quite as dramatic (factor of 5, not 50).


-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3d-917-gb9c506




Re: [O] How to improve Org startup time?

2013-01-31 Thread Nick Dokos
Eric S Fraga e.fr...@ucl.ac.uk wrote:

 - start emacs
 - M-x elp-instrument-package RET org-agenda RET
 - M-x org-agenda-to-apt RET
 - M-x elp-results
 - quit emacs
 
 now gives me
 
 | org-agenda-to-appt |   1 |  1.602924479 |  1.602924479 |
 | org-agenda-prepare-buffers |   1 |  1.510812568 |  1.510812568 |
 | org-agenda-get-day-entries |  14 |  0.088741138 | 0.0063386527 |
 | org-agenda-get-scheduled   |  14 |  0.027990309 | 0.0019993077 |
 | org-agenda-get-deadlines   |  14 | 0.0154423710 | 0.0011030265 |
 | org-agenda-skip| 797 |  0.008103603 | 1.016...e-05 |
 
 so the reduction is not quite as dramatic (factor of 5, not 50).
 
 

That's roughly the kind of numbers I see as well.

Nick



Re: [O] How to improve Org startup time?

2013-01-30 Thread Sebastien Vauban
Hi Nick,

Nick Dokos wrote:
 Sebastien Vauban wxhgmqzgw...@spammotel.com wrote:
  This may have something to do with my big amount of Org files in
  `org-agenda-files': 36 at this point. But is that so big??
 
  I don't think so.

 I'm sure it is, as I wrote (removed from the joined log) a message call
 before and after that line, and those time-stamps were 16 seconds one from 
 the
 other.

 Small misunderstanding here: the I don't think so was a reply
 to the is that so big? question.

It was already late for me it seems. Yes, I misunderstood your point. Anyway,
I don't mind getting reminded of things which could have escaped me!

  Can you get a profile?

 You're right I should use real tools for that...

  M-x elp-instrument-package RET org-agenda RET
  M-x org-agenda-to-appt
  M-x elp-results
 
  In my (admittedly unchallenging, run-of-the-mill) setup, I get
  (with everything already loaded):
 
  org-agenda-to-appt1   
  0.053846964   0.053846964
  org-agenda-prepare-buffers1   
  0.028483817   0.028483817
  org-agenda-get-day-entries8   
  0.024222044   0.0030277555
  org-agenda-get-scheduled  8   
  0.0154506449  0.0019313306
  org-agenda-get-timestamps 8   
  0.004179949   0.0005224936
  org-agenda-skip   184 
  0.0027937810  1.518...e-05
  org-agenda-files  2   
  0.001386068   0.000693034
  org-agenda-get-deadlines  8   
  0.001288303   0.0001610378
  org-agenda-format-item22  
  0.0012140690  5.518...e-05
  org-agenda-get-blocks 8   
  0.0007851970  9.814...e-05
  org-agenda-new-marker 44  
  0.0006114019  1.389...e-05
  org-agenda-skip-eval  368 
  0.0001511950  4.108...e-07
  org-agenda-todayp 16  
  0.0001342800  8.392...e-06
  org-agenda-fix-displayed-tags 22  
  7.2914e-053.314...e-06
  org-agenda-get-category-icon  22  
  1.8382e-058.355...e-07
  org-agenda-time-of-day-to-ampm-maybe  6   
  3.347e-06 5.578...e-07
 
  A factor of 300: maybe it's real, but let's make sure first.

 Here it is. I don't know how to interpret that difference, tho.

 org-agenda-to-appt1   
 19.67319.673
 org-agenda-prepare-buffers1   
 18.86 18.86
 org-agenda-get-day-entries36  
 0.797000  0.022138
 org-agenda-files  37  
 0.544000  0.0147027027
 org-agenda-get-scheduled  36  
 0.515000  0.014305
 org-agenda-get-deadlines  36  
 0.158000  0.004388
 org-agenda-skip   612 
 0.141000  0.0002303921
 org-agenda-get-timestamps 36  
 0.047 0.001305
 org-agenda-get-blocks 36  
 0.046 0.001277
 org-agenda-format-item42  
 0.031 0.0007380952
 org-agenda-skip-eval  1204
 0.016 1.32...e-005
 org-agenda-fix-displayed-tags 42  
 0.0   0.0
 org-agenda-todayp 72  
 0.0   0.0
 org-agenda-new-marker 89  
 0.0   0.0
 org-agenda-deadline-face  2   
 0.0   0.0
 org-agenda-get-category-icon  42  
 0.0   0.0

 Well, you have a bigger agenda by a factor of 4-5

Well, I'm still under the floating line, for what concerns GTD (in the sense
of getting things _DONE_).

 and I guess a slower machine, but it all takes less than a second except for
 one thing: the big difference seems to be org-agend-prepare-buffers which
 opens the files, reads them in and gets the buffers ready.

Well, I did have a slow machine (6-year old, 2 GB RAM and plain old HD) up to
last month. Now, I do have a brand new Asus laptop with 4 GB RAM and 256 GB
SSD... It can't be that slow. Not possible...

I have to admit working most of the time without the laptop being powered,
which 

Re: [O] How to improve Org startup time?

2013-01-30 Thread Sebastien Vauban
Hi Bastien,

Bastien wrote:
 Sebastien Vauban writes:

 In particular, you'll see that *16 seconds* are lost between 21:20:30 and
 21:20:46. They correspond to the executiong of just *one line*:

 #+begin_src emacs-lisp
   (org-agenda-to-appt)
 #+end_src

 This may have something to do with my big amount of Org files in
 `org-agenda-files': 36 at this point. But is that so big??

 There are basically two factors that can slow down the agenda generation:
 the number of agenda files, the number of entries to check in all agenda
 files.

 Can you compare the time spent by the initialization process before and
 after commit 582cca5806 ?

I'll do at noon.

 It should improve things sensibly, I'd be curious to know why it does not
 improve anything -- if that's the case.

 Also, do you have any hooks in org-mode-hook?

Of course ;-)

Here, the full collection (in real life, they're at different spots of my
.emacs file):

--8---cut here---start-8---
;; whitespace mode
(add-hook 'text-mode-hook
  (lambda ()
(whitespace-mode 1)))

;; activate Auto Fill for all text mode buffers
(add-hook 'text-mode-hook 'turn-on-auto-fill)

(add-hook 'org-mode-hook
  (lambda ()
(local-set-key (kbd \C-\M-n) 'outline-next-visible-heading)
(local-set-key (kbd \C-\M-p) 'outline-previous-visible-heading)
(local-set-key (kbd \C-\M-u) 'outline-up-heading)))

(add-hook 'org-mode-hook
  (lambda ()
;; (local-set-key \M-n 'outline-next-visible-heading)
;; (local-set-key \M-p 'outline-previous-visible-heading)

(local-set-key (kbd C-c h) 'hide-other)

;; table
(local-set-key \M-\C-w 'org-table-copy-region)
(local-set-key \M-\C-y 'org-table-paste-rectangle)
(local-set-key \M-\C-l 'org-table-sort-lines)))

(add-hook 'org-mode-hook
  (lambda() (add-to-list 'mode-line-format
 '(:eval (org-propertize
  (org-display-outline-path nil t  /  
t)
 'face 'mode-line-emphasis
 'help-echo Outline path)) t)))

(add-hook 'org-mode-hook
  (lambda ()
(define-key org-agenda-keymap
  L 'lvn/org-agenda-toggle-list-category)
(define-key org-agenda-mode-map
  L 'lvn/org-agenda-toggle-list-category)))

(add-hook 'org-mode-hook
  (lambda ()
(setq imenu-generic-expression
  org-src-blocks-imenu-generic-expression

(add-hook 'org-mode-hook
  (lambda ()
;; YASnippet (using the new org-cycle hooks)
(set (make-local-variable 'yas/trigger-key) (kbd tab)) ;; needed?
(add-to-list 'org-tab-first-hook
 'yas/org-very-safe-expand)
(define-key yas/keymap (kbd tab) 'yas/next-field) ;; needed?
)))

(add-hook 'org-mode-hook
  (lambda ()
(local-set-key (kbd C-c m) 'org-mime-subtree)))
--8---cut here---end---8---

This is the result of searching for the following strings:

- text-mode-hook
- outline-mode-hook
- org-mode-hook

 Finally, org-agenda-to-appt is very slow by default, it uses
 org-agenda-get-day-entries and check every entry... see the docstring on how
 to make it check only the ones you really need.

Euh...

╭
│ org-agenda-get-day-entries is a Lisp function in `org-agenda.el'.
│
│ (org-agenda-get-day-entries rest ARGS)
│
│ Not documented.
╰

╭
│ org-agenda-to-appt is an interactive autoloaded Lisp function in
│ `org-agenda.el'.
│
│ (org-agenda-to-appt optional REFRESH FILTER rest ARGS)
│
│ Not documented.
╰

What am I missing?

Best regards,
  Seb

--
Sebastien Vauban




Re: [O] How to improve Org startup time?

2013-01-30 Thread Daimrod
Sebastien Vauban wxhgmqzgw...@spammotel.com writes:

 Finally, org-agenda-to-appt is very slow by default, it uses
 org-agenda-get-day-entries and check every entry... see the docstring on how
 to make it check only the ones you really need.

 Euh...

 ╭
 │ org-agenda-get-day-entries is a Lisp function in `org-agenda.el'.
 │
 │ (org-agenda-get-day-entries rest ARGS)
 │
 │ Not documented.
 ╰

 ╭
 │ org-agenda-to-appt is an interactive autoloaded Lisp function in
 │ `org-agenda.el'.
 │
 │ (org-agenda-to-appt optional REFRESH FILTER rest ARGS)
 │
 │ Not documented.
 ╰

 What am I missing?

Those functions should be documented. Here is what I have:

 org-agenda-get-day-entries is a compiled Lisp function in
 `org-agenda.el'.
 
 (org-agenda-get-day-entries FILE DATE rest ARGS)
 
 Does the work for `org-diary' and `org-agenda'.
 FILE is the path to a file to be checked for entries.  DATE is date like
 the one returned by `calendar-current-date'.  ARGS are symbols indicating
 which kind of entries should be extracted.  For details about these, see
 the documentation of `org-diary'.

 org-agenda-to-appt is an interactive autoloaded compiled Lisp function
 in `org-agenda.el'.
 
 (org-agenda-to-appt optional REFRESH FILTER rest ARGS)
 
 Activate appointments found in `org-agenda-files'.
 With a C-u prefix, refresh the list of
 appointments.
 
 If FILTER is t, interactively prompt the user for a regular
 expression, and filter out entries that don't match it.
 
 If FILTER is a string, use this string as a regular expression
 for filtering entries out.
 
 If FILTER is a function, filter out entries against which
 calling the function returns nil.  This function takes one
 argument: an entry from `org-agenda-get-day-entries'.
 
 FILTER can also be an alist with the car of each cell being
 either 'headline or 'category.  For example:
 
   '((headline IMPORTANT)
 (category Work))
 
 will only add headlines containing IMPORTANT or headlines
 belonging to the Work category.
 
 ARGS are symbols indicating what kind of entries to consider.
 By default `org-agenda-to-appt' will use :deadline, :scheduled
 and :timestamp entries.  See the docstring of `org-diary' for
 details and examples.
 
 If an entry as a APPT_WARNTIME property, its value will be used
 to override `appt-message-warning-time'.

-- 
Daimrod/Greg


pgpICwhkLc485.pgp
Description: PGP signature


Re: [O] How to improve Org startup time?

2013-01-30 Thread Daniel Clemente

  Per chance, you did not forget to M-x compile ? ;)
 
 Good to remind me/us with that, but, once again, no, as I do not use compiled
 Org files. That way, I'm sure not to forget such recompile step -- which I
 would definitely do once in a while!
 

  If you are worried about speed, you should always byte-compile, because it's 
easy and byte-compiled code is faster.
  Just do a make after each git pull.




Re: [O] How to improve Org startup time?

2013-01-30 Thread Sebastien Vauban
Hi Bastien,

Bastien wrote:
 Can you compare the time spent by the initialization process before and
 after commit 582cca5806 ?

 It should improve things sensibly, I'd be curious to know why it does not
 improve anything -- if that's the case.

Before giving the results, let me tell you I've now tested as well with the
laptop being powered or not. That does change things in a factor 1 to 3.
However, still far behind Nick's results.

Here the results of the jury (elapsed time of `org-agenda-to-appt'):

| commit | date   | time (not powered) | time (powered) | ratio |
|++++---|
| f52600 | Jan 26 |  19.27 |   5.56 |   3.5 |
| 0cf717 | Jan 21 |  19.74 |   5.84 |   3.4 |
#+TBLFM: $5=$3/$4;%.1f

These are the means over a couple of tests. But the maximum variance (over
that small number of tests) is only about 0.04 s -- in powered mode.

That is: yes, things are better, up to 5%. But, on this example, not quite
significant... ;-(

FYI, I tried the ultimately current version (f518bc8) but there is a parsing
error in `org-e-odt.el' -- I guess since commit 35f944a of this morning?

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] How to improve Org startup time?

2013-01-30 Thread Sebastien Vauban
Hi Daniel,

Daniel Clemente wrote:
 Per chance, you did not forget to M-x compile ? ;)

 Good to remind me/us with that, but, once again, no, as I do not use compiled
 Org files. That way, I'm sure not to forget such recompile step -- which I
 would definitely do once in a while!

 If you are worried about speed, you should always byte-compile, because it's
 easy and byte-compiled code is faster.
 Just do a make after each git pull.

I know it's easy, but I know myself, and I'm sure to lose hours of work
because, at some point in time, I'll forget to compile the stuff after having
made one change.

Plus, from the speed comparisons I had done once, I felt the difference as
being completely marginal.

Do you really notice a speed improvement when using the compiled files?

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] How to improve Org startup time?

2013-01-30 Thread Florian Beck



Sebastien Vauban
wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org writes:

 I have to admit working most of the time without the laptop being powered,
 which I know (from observation) is 2 to 3 times slower. 

So maybe your disk is powered down or in a sleep mode in order to save
power? Could you check whether you get the same result with your laptop
powered? 






Re: [O] How to improve Org startup time?

2013-01-30 Thread Bastien


Hi Sébastien,

put your .emacs on diet :)  More seriously, I would start by checking
org-agenda-to-appt documentation.  It should be on your system.  If it 
is not, check online.  That's what really slows down your config.

Then, when this is done, I would try to use only those hooks that are
really necessary.  

My 2 cts of course,

-- 
 Bastien




Re: [O] How to improve Org startup time?

2013-01-30 Thread Achim Gratz
Sebastien Vauban writes:
 These are the means over a couple of tests. But the maximum variance (over
 that small number of tests) is only about 0.04 s -- in powered mode.

File operations on Windows _are_ slow to start with and since a virus
scanner is more or less required these days, opening a file is getting
slower yet.


Regards,
Achim.
-- 
+[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+

Wavetables for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables




Re: [O] How to improve Org startup time?

2013-01-30 Thread Sebastien Vauban
Hi Bastien,

Bastien wrote:
 put your .emacs on diet :) More seriously, I would start by checking
 org-agenda-to-appt documentation. It should be on your system. If it is not,
 check online.

I tried to filter to only timestamp entries with the following:

#+begin_src emacs-lisp
  (org-agenda-to-appt nil nil '(:timestamp))
#+end_src

But that does not work -- no error, but no event added to the appt list!

I must not understand the rest parameter, I guess.

 That's what really slows down your config.

Yes and no.

Yes, because it's currently run at startup time, even if I put that command
inside an eval-after-load org-agenda (as `org-agenda' is ultimately called
when `org-clock-persist' is set).

No, because no running that does not change the fact that, sooner or later,
the Org agenda files will have to be loaded and scanned through.

Not having that done at startup simply _add_ another 16 seconds delay to the
computation of the first agenda view; not a gain IMO.

 Then, when this is done, I would try to use only those hooks that are really
 necessary.

Are you referring to something in particular?

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] How to improve Org startup time?

2013-01-30 Thread Sebastien Vauban
Hi Achim,

Achim Gratz wrote:
 Sebastien Vauban writes:
 These are the means over a couple of tests. But the maximum variance (over
 that small number of tests) is only about 0.04 s -- in powered mode.

 File operations on Windows _are_ slow to start with and since a virus
 scanner is more or less required these days, opening a file is getting
 slower yet.

You may be right, but I guess that I'm not alone using Windows 8, so my
performance observations must be shared by others as well. It may even be
worse for some who have more Org files, and a less powerful computer.

So, I'm trying to think what could be done to split the full Org load time
(loading the packages, loading the Org agenda files, scanning them, computing
an agenda view, etc.) into smaller chunks, that the user would experience
depending on his current actions.

For example, why do all the Org agenda files have to be loaded when I'm simply
opening a plain common (I mean: not part of the agenda) Org file?

I don't know if that's possible (or maybe it's already done so), but the
opposite question could make sense: why would have Org agenda buffers to be
fully fontified when the only useful information for building an agenda view
is the time information the entries contain (deadline, scheduled,
timestamp).

Hence, my initial request for information:

 I would like to have:

 - the minimal Org config loaded when opening any .org file; IOW, certainly
   not the agenda files!

 - all files in `org-agenda-files' when calling any agenda view (C-c a ...)

 - the current clocked file when resume Org's clock mechanism.

 I'm ready to look at where to cut branches of the Org tree, if that does
 make sense to you. Does it?

on which I had no comment.

Best regards,
  Seb

--
Sebastien Vauban




Re: [O] How to improve Org startup time?

2013-01-30 Thread Bastien


Sebastien Vauban
wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org writes:

 Plus, from the speed comparisons I had done once, I felt the difference as
 being completely marginal.

FWIW this is also what I observed, I don't compile anymore.

-- 
 Bastien




Re: [O] How to improve Org startup time?

2013-01-30 Thread Eric S Fraga
Sebastien Vauban wxhgmqzgw...@spammotel.com writes:

 Hello,

 Please find here an enriched log of the packages which are loaded for Org, and
 the time it takes.

 [2013-01-29 21:20:18] (info) +- Requiring `appt'...
 [2013-01-29 21:20:18] (info)   +- Requiring `diary-lib'...
 [2013-01-29 21:20:18] (info) +- Requiring `calendar'...

Seb,

how do you get this output?  It looks very useful!

In terms of the actual topic of this thread, I can say that the recent
changes to org for startup have led to a significant decrease in my
emacs startup time.  Thanks to all that have done this!

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3d-917-gb9c506




Re: [O] How to improve Org startup time?

2013-01-30 Thread Eric S Fraga
Daniel Clemente n142...@gmail.com writes:

   If you are worried about speed, you should always byte-compile, because 
 it's easy and byte-compiled code is faster.
   Just do a make after each git pull.

I do compile org but I do not compile any of my start-up files; this is
a practice I got into when I was running different versions of emacs
(e.g. 22 vs 23 vs 24) on different systems (from a wee N800 to a huge
multi-core system) but with shared startup files.

I say this in case the speedups I am observing are more noticeable if
using non-compiled code and others are wondering why they don't observe
any speedups.

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3d-917-gb9c506




Re: [O] How to improve Org startup time?

2013-01-30 Thread Eric S Fraga
Some timings on a 3-4 (?) year old netbook with Intel N450 Atom @1.66GHz
dual core powered:

With old org, actually from October 2012 (!) as this system acts as a
cloud server for me so I don't actually use it interactively much:

| org-agenda-to-appt |   1 | 12.525722775  | 12.525722775  |
| org-agenda-prepare-buffers |   2 | 10.719484861  |  5.3597424305 |
| org-agenda-get-day-entries |  15 |  1.4113181819 |  0.0940878787 |
| org-agenda-get-scheduled   |  15 |  1.032943071  |  0.0688628714 |
| org-agenda-get-deadlines   |  14 |  0.2688785840 |  0.0192056131 |
| org-agenda-skip| 797 |  0.1879489969 |  0.0002358205 |

and with up to date org as of a few minutes ago:

| org-agenda-to-appt |   1 | 9.168879079  | 9.168879079  |
| org-agenda-prepare-buffers |   2 | 8.1717637810 | 4.0858818905 |
| org-agenda-get-day-entries |  15 | 0.5261351449 | 0.0350756763 |
| org-agenda-get-deadlines   |  14 | 0.253867925  | 0.0181334232 |
| org-agenda-get-scheduled   |  15 | 0.1835072029 | 0.0122338135 |
| org-agenda-skip| 797 | 0.0482942050 | 6.059...e-05 |


 
I.e. an approximately 25% reduction in time overall so I think
org-agenda is significantly faster (okay, not orders of magnitude) but
the time taken is dominated by org-agenda-prepare-buffers on this
system.

However, more interestingly, on a 1 year old desktop computer Intel Core
i5-2500 @ 3.30 GHz, I get very different behaviour:

| org-agenda-to-appt |   1 | 0.182718048  | 0.182718048  |
| org-agenda-get-day-entries |  14 | 0.095832824  | 0.0068452017 |
| org-agenda-prepare-buffers |   1 | 0.086104933  | 0.086104933  |
| org-agenda-get-scheduled   |  14 | 0.067475949  | 0.0048197106 |
| org-agenda-skip| 794 | 0.0475198030 | 5.984...e-05 |
| org-agenda-get-deadlines   |  14 | 0.014998552  | 0.0010713251 |

[note: slightly different agenda files as the cloud server copy of my
agenda files is a couple of hours behind my desktop]

Notice the big change in org-agenda-prepare-buffers relative to the
other calls.  Disk performance is almost likely the key here and I think
the recent improvements are quite dramatic but I haven't had a chance to
time these yet.

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3d-917-gb9c506




[O] How to improve Org startup time?

2013-01-29 Thread Sebastien Vauban
Hello,

Please find here an enriched log of the packages which are loaded for Org, and
the time it takes.

--8---cut here---start-8---
[2013-01-29 21:20:18] (info) +- Requiring `appt'...
[2013-01-29 21:20:18] (info)   +- Requiring `diary-lib'...
[2013-01-29 21:20:18] (info) +- Requiring `calendar'...
[2013-01-29 21:20:18] (info) Loading c:/Program Files 
(x86)/emacs-24.2.91/lisp/calendar/cal-loaddefs.el...
[2013-01-29 21:20:18] (info)   +- Requiring `cal-menu'...
[2013-01-29 21:20:18] (info) +- Requiring `calendar'... already loaded
[2013-01-29 21:20:18] (info)   +- Requiring `cal-menu'... c:/Program Files 
(x86)/emacs-24.2.91/lisp/calendar/cal-menu.elc (loaded in 0.08 s)
[2013-01-29 21:20:18] (info) +- Requiring `calendar'... c:/Program Files 
(x86)/emacs-24.2.91/lisp/calendar/calendar.elc (loaded in 0.33 s)
[2013-01-29 21:20:18] (info) Loading c:/Program Files 
(x86)/emacs-24.2.91/lisp/calendar/diary-loaddefs.el...
[2013-01-29 21:20:19] (info)   +- Requiring `diary-lib'... c:/Program Files 
(x86)/emacs-24.2.91/lisp/calendar/diary-lib.elc (loaded in 0.55 s)
[2013-01-29 21:20:19] (info) +- Requiring `appt'... c:/Program Files 
(x86)/emacs-24.2.91/lisp/calendar/appt.elc (loaded in 0.64 s)
[2013-01-29 21:20:19] (info) Enable appointment reminders...
[2013-01-29 21:20:19] Appointment reminders enabled (no diary file found)
[2013-01-29 21:20:19] (info) Enable appointment reminders... Done
[2013-01-29 21:20:19] (info) +- Requiring `org-clock'...
[2013-01-29 21:20:19] (info)   +- Requiring `org-exp'...
[2013-01-29 21:20:19] (info) +- Requiring `org'...
[2013-01-29 21:20:19] (info)   +- Requiring `cl'... already loaded
[2013-01-29 21:20:19] (info)   +- Requiring `gnus-sum'...
[2013-01-29 21:20:19] (info) +- Requiring `gnus'...
[2013-01-29 21:20:19] (info)   +- Requiring `wid-edit'... c:/Program 
Files (x86)/emacs-24.2.91/lisp/wid-edit.elc (loaded in 0.08 s)
[2013-01-29 21:20:19] (info)   +- Requiring `mm-util'...
[2013-01-29 21:20:19] (info) +- Requiring `mail-prsvr'... 
d:/home/sva/Public/Repositories/gnus/lisp/mail-prsvr.elc (loaded in 0.02 s)
[2013-01-29 21:20:19] (info) +- Requiring `timer'... already loaded
[2013-01-29 21:20:19] (info)   +- Requiring `mm-util'... 
d:/home/sva/Public/Repositories/gnus/lisp/mm-util.elc (loaded in 0.14 s)
[2013-01-29 21:20:19] (info)   +- Requiring `nnheader'...
[2013-01-29 21:20:19] (info) +- Requiring `mail-utils'... 
c:/Program Files (x86)/emacs-24.2.91/lisp/mail/mail-utils.elc (loaded in 0.05 s)
[2013-01-29 21:20:19] (info) +- Requiring `mm-util'... already 
loaded
[2013-01-29 21:20:19] (info) +- Requiring `gnus-util'...
[2013-01-29 21:20:19] (info)   +- Requiring `time-date'... already 
loaded
[2013-01-29 21:20:19] (info) +- Requiring `gnus-util'... 
d:/home/sva/Public/Repositories/gnus/lisp/gnus-util.elc (loaded in 0.08 s)
[2013-01-29 21:20:19] (info)   +- Requiring `nnheader'... 
d:/home/sva/Public/Repositories/gnus/lisp/nnheader.elc (loaded in 0.16 s)
[2013-01-29 21:20:19] (info)   +- Requiring `gnus-compat'...
[2013-01-29 21:20:19] (info) +- Requiring `help-fns'... already 
loaded
[2013-01-29 21:20:19] (info) +- Requiring `url'...
[2013-01-29 21:20:19] (info)   +- Requiring `mailcap'... 
d:/home/sva/Public/Repositories/gnus/lisp/mailcap.elc (loaded in 0.02 s)
[2013-01-29 21:20:19] (info)   +- Requiring `url-vars'... 
c:/Program Files (x86)/emacs-24.2.91/lisp/url/url-vars.elc (loaded in 0.05 s)
[2013-01-29 21:20:19] (info)   +- Requiring `url-cookie'...
[2013-01-29 21:20:19] (info) +- Requiring `url-util'...
[2013-01-29 21:20:19] (info)   +- Requiring `url-parse'...
[2013-01-29 21:20:19] (info) +- Requiring `url-vars'... 
already loaded
[2013-01-29 21:20:19] (info) +- Requiring `auth-source'...
[2013-01-29 21:20:19] (info)   +- Requiring 
`password-cache'...
[2013-01-29 21:20:20] (info)   +- Requiring 
`password-cache'... 
d:/home/sva/Public/Repositories/gnus/lisp/password-cache.elc (loaded in 0.03 s)
[2013-01-29 21:20:20] (info)   +- Requiring `mm-util'... 
already loaded
[2013-01-29 21:20:20] (info)   +- Requiring `gnus-util'... 
already loaded
[2013-01-29 21:20:20] (info)   +- Requiring `eieio'...
[2013-01-29 21:20:20] (info) +- Requiring `bytecomp'...
[2013-01-29 21:20:20] (info)   +- Requiring 
`backquote'... already loaded
[2013-01-29 21:20:20] (info)   +- Requiring 
`macroexp'... already loaded
[2013-01-29 21:20:20] (info)   +- Requiring `cconv'... 
c:/Program Files (x86)/emacs-24.2.91/lisp/emacs-lisp/cconv.elc (loaded in 0.05 
s)

Re: [O] How to improve Org startup time?

2013-01-29 Thread Daimrod
Sebastien Vauban wxhgmqzgw...@spammotel.com writes:

 Hello,

Hello Sebastien,

 I would like to have:

 - the minimal Org config loaded when opening any .org file; IOW, certainly not
   the agenda files!

 - all files in `org-agenda-files' when calling any agenda view (C-c a ...)

 - the current clocked file when resume Org's clock mechanism.

 I'm ready to look at where to cut branches of the Org tree, if that does make
 sense to you. Does it?

You could try to pull from the main branch and test the latest option
pushed by Bastien to improve the agenda startup.

This option, `org-agenda-inhibit-startup', is set by default to t so
shouldn't have anything to configure.

Here is the original thread: http://comments.gmane.org/gmane.emacs.orgmode/65215

 Best regards,
   Seb

 [1] Don't assume it's not related to some problem in my config. But, for this
 point, AFAIU, it's not the case.

-- 
Daimrod/Greg


pgpxSMkRBXxEG.pgp
Description: PGP signature


Re: [O] How to improve Org startup time?

2013-01-29 Thread Sebastien Vauban
Hello Daimrod,

Daimrod wrote:
 Sebastien Vauban wxhgmqzgw...@spammotel.com writes:
 I would like to have:

 - the minimal Org config loaded when opening any .org file; IOW, certainly 
 not
   the agenda files!

 - all files in `org-agenda-files' when calling any agenda view (C-c a ...)

 - the current clocked file when resume Org's clock mechanism.

 I'm ready to look at where to cut branches of the Org tree, if that does make
 sense to you. Does it?

 You could try to pull from the main branch and test the latest option
 pushed by Bastien to improve the agenda startup.

 This option, `org-agenda-inhibit-startup', is set by default to t so
 shouldn't have anything to configure.

Thanks for your notice -- it could (have) help(ed)... if I wasn't already
(quite) up-to-date; here's the results of `git log':

--8---cut here---start-8---
commit f52600a43908d5b246901780b9a761e477ec5604
Author: Eric Schulte schulte.e...@gmail.com
Date:   Sat Jan 26 13:58:15 2013 -0700

fix bug: tangling #+headers: lines w/prefix arg

commit bb40d29b45e091f3a4226c890e1130299c4dffd4
Author: Nicolas Goaziou n.goaz...@gmail.com
Date:   Sat Jan 26 18:05:56 2013 +0100

org-export: Fix subtree export when parent section is empty

* contrib/lisp/org-export.el (org-export--get-subtree-options): When
  point is at an headline and subtree export is called, make sure
  export properties are extracted from parent headline.
* testing/lisp/test-org-export.el: Add test.

commit 5e11659e66845e918a047f4a89d171f599729174
Merge: 714b372 a119649
Author: Bastien Guerry b...@altern.org
Date:   Sat Jan 26 15:11:21 2013 +0100

Merge branch 'maint'

Conflicts:
lisp/org.el

commit a1196499237b6a0389fba2d21b69c34068404519
Author: Bastien Guerry b...@altern.org
Date:   Sat Jan 26 15:10:43 2013 +0100

org.el (org-agenda-inhibit-startup): Rename from 
`org-agenda-inhibit-startup-visibility-cycling'

* org.el (org-agenda-inhibit-startup): Rename from
`org-agenda-inhibit-startup-visibility-cycling'.
(org-agenda-prepare-buffers): Bind `org-inhibit-startup' to
`org-agenda-inhibit-startup'.
--8---cut here---end---8---

I must admit I did not see any improvement -- at least, even if I did not make
any measures before and after that, I did not feel any improvement.

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] How to improve Org startup time?

2013-01-29 Thread Nick Dokos
Sebastien Vauban wxhgmqzgw...@spammotel.com wrote:


 In particular, you'll see that *16 seconds* are lost between 21:20:30 and
 21:20:46. They correspond to the executiong of just *one line*:
 
 #+begin_src emacs-lisp
   (org-agenda-to-appt)
 #+end_src
 
 This may have something to do with my big amount of Org files in
 `org-agenda-files': 36 at this point. But is that so big??
 

I don't think so.

Can you get a profile?

M-x elp-instrument-package RET org-agenda RET
M-x org-agenda-to-appt
M-x elp-results

In my (admittedly unchallenging, run-of-the-mill) setup, I get
(with everything already loaded):

org-agenda-to-appt1   
0.053846964   0.053846964
org-agenda-prepare-buffers1   
0.028483817   0.028483817
org-agenda-get-day-entries8   
0.024222044   0.0030277555
org-agenda-get-scheduled  8   
0.0154506449  0.0019313306
org-agenda-get-timestamps 8   
0.004179949   0.0005224936
org-agenda-skip   184 
0.0027937810  1.518...e-05
org-agenda-files  2   
0.001386068   0.000693034
org-agenda-get-deadlines  8   
0.001288303   0.0001610378
org-agenda-format-item22  
0.0012140690  5.518...e-05
org-agenda-get-blocks 8   
0.0007851970  9.814...e-05
org-agenda-new-marker 44  
0.0006114019  1.389...e-05
org-agenda-skip-eval  368 
0.0001511950  4.108...e-07
org-agenda-todayp 16  
0.0001342800  8.392...e-06
org-agenda-fix-displayed-tags 22  
7.2914e-053.314...e-06
org-agenda-get-category-icon  22  
1.8382e-058.355...e-07
org-agenda-time-of-day-to-ampm-maybe  6   
3.347e-06 5.578...e-07

A factor of 300: maybe it's real, but let's make sure first.

Nick




Re: [O] How to improve Org startup time?

2013-01-29 Thread Daimrod
Sebastien Vauban wxhgmqzgw...@spammotel.com writes:

 Hello Daimrod,

 Daimrod wrote:
 Sebastien Vauban wxhgmqzgw...@spammotel.com writes:
 I would like to have:

 - the minimal Org config loaded when opening any .org file; IOW, certainly 
 not
   the agenda files!

 - all files in `org-agenda-files' when calling any agenda view (C-c a ...)

 - the current clocked file when resume Org's clock mechanism.

 I'm ready to look at where to cut branches of the Org tree, if that does 
 make
 sense to you. Does it?

 You could try to pull from the main branch and test the latest option
 pushed by Bastien to improve the agenda startup.

 This option, `org-agenda-inhibit-startup', is set by default to t so
 shouldn't have anything to configure.

 Thanks for your notice -- it could (have) help(ed)... if I wasn't already
 (quite) up-to-date; here's the results of `git log':

 commit f52600a43908d5b246901780b9a761e477ec5604
 Author: Eric Schulte schulte.e...@gmail.com
 Date:   Sat Jan 26 13:58:15 2013 -0700

 fix bug: tangling #+headers: lines w/prefix arg

 commit bb40d29b45e091f3a4226c890e1130299c4dffd4
 Author: Nicolas Goaziou n.goaz...@gmail.com
 Date:   Sat Jan 26 18:05:56 2013 +0100

 org-export: Fix subtree export when parent section is empty

 * contrib/lisp/org-export.el (org-export--get-subtree-options): When
   point is at an headline and subtree export is called, make sure
   export properties are extracted from parent headline.
 * testing/lisp/test-org-export.el: Add test.

 commit 5e11659e66845e918a047f4a89d171f599729174
 Merge: 714b372 a119649
 Author: Bastien Guerry b...@altern.org
 Date:   Sat Jan 26 15:11:21 2013 +0100

 Merge branch 'maint'

 Conflicts:
 lisp/org.el

 commit a1196499237b6a0389fba2d21b69c34068404519
 Author: Bastien Guerry b...@altern.org
 Date:   Sat Jan 26 15:10:43 2013 +0100

 org.el (org-agenda-inhibit-startup): Rename from 
 `org-agenda-inhibit-startup-visibility-cycling'

 * org.el (org-agenda-inhibit-startup): Rename from
 `org-agenda-inhibit-startup-visibility-cycling'.
 (org-agenda-prepare-buffers): Bind `org-inhibit-startup' to
 `org-agenda-inhibit-startup'.

 I must admit I did not see any improvement -- at least, even if I did not make
 any measures before and after that, I did not feel any improvement.

Per chance, you did not forget to M-x compile ? ;)

Joking aside, I'm sad it didn't any sensible improvement.

-- 
Daimrod/Greg


pgpT8YfVzH5VQ.pgp
Description: PGP signature


Re: [O] How to improve Org startup time?

2013-01-29 Thread Sebastien Vauban
Hi Nick,

Thanks for looking into this as well!

Nick Dokos wrote:
 Sebastien Vauban wxhgmqzgw...@spammotel.com wrote:
 In particular, you'll see that *16 seconds* are lost between 21:20:30 and
 21:20:46. They correspond to the executiong of just *one line*:
 
 #+begin_src emacs-lisp
   (org-agenda-to-appt)
 #+end_src
 
 This may have something to do with my big amount of Org files in
 `org-agenda-files': 36 at this point. But is that so big??

 I don't think so.

I'm sure it is, as I wrote (removed from the joined log) a message call
before and after that line, and those time-stamps were 16 seconds one from the
other.

 Can you get a profile?

You're right I should use real tools for that...

 M-x elp-instrument-package RET org-agenda RET
 M-x org-agenda-to-appt
 M-x elp-results

 In my (admittedly unchallenging, run-of-the-mill) setup, I get
 (with everything already loaded):

 org-agenda-to-appt1   
 0.053846964   0.053846964
 org-agenda-prepare-buffers1   
 0.028483817   0.028483817
 org-agenda-get-day-entries8   
 0.024222044   0.0030277555
 org-agenda-get-scheduled  8   
 0.0154506449  0.0019313306
 org-agenda-get-timestamps 8   
 0.004179949   0.0005224936
 org-agenda-skip   184 
 0.0027937810  1.518...e-05
 org-agenda-files  2   
 0.001386068   0.000693034
 org-agenda-get-deadlines  8   
 0.001288303   0.0001610378
 org-agenda-format-item22  
 0.0012140690  5.518...e-05
 org-agenda-get-blocks 8   
 0.0007851970  9.814...e-05
 org-agenda-new-marker 44  
 0.0006114019  1.389...e-05
 org-agenda-skip-eval  368 
 0.0001511950  4.108...e-07
 org-agenda-todayp 16  
 0.0001342800  8.392...e-06
 org-agenda-fix-displayed-tags 22  
 7.2914e-053.314...e-06
 org-agenda-get-category-icon  22  
 1.8382e-058.355...e-07
 org-agenda-time-of-day-to-ampm-maybe  6   
 3.347e-06 5.578...e-07

 A factor of 300: maybe it's real, but let's make sure first.

Here it is. I don't know how to interpret that difference, tho.

--8---cut here---start-8---
org-agenda-to-appt1   
19.67319.673
org-agenda-prepare-buffers1   18.86 
18.86
org-agenda-get-day-entries36  
0.797000  0.022138
org-agenda-files  37  
0.544000  0.0147027027
org-agenda-get-scheduled  36  
0.515000  0.014305
org-agenda-get-deadlines  36  
0.158000  0.004388
org-agenda-skip   612 
0.141000  0.0002303921
org-agenda-get-timestamps 36  0.047 
0.001305
org-agenda-get-blocks 36  0.046 
0.001277
org-agenda-format-item42  0.031 
0.0007380952
org-agenda-skip-eval  12040.016 
1.32...e-005
org-agenda-fix-displayed-tags 42  0.0   
0.0
org-agenda-todayp 72  0.0   
0.0
org-agenda-new-marker 89  0.0   
0.0
org-agenda-deadline-face  2   0.0   
0.0
org-agenda-get-category-icon  42  0.0   
0.0
--8---cut here---end---8---

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] How to improve Org startup time?

2013-01-29 Thread Sebastien Vauban
Daimrod,

Daimrod wrote:
 Sebastien Vauban wxhgmqzgw...@spammotel.com writes:
 Daimrod wrote:
 Sebastien Vauban wxhgmqzgw...@spammotel.com writes:
 I would like to have:

 - the minimal Org config loaded when opening any .org file; IOW, certainly 
 not
   the agenda files!

 - all files in `org-agenda-files' when calling any agenda view (C-c a ...)

 - the current clocked file when resume Org's clock mechanism.

 I'm ready to look at where to cut branches of the Org tree, if that does 
 make
 sense to you. Does it?

 You could try to pull from the main branch and test the latest option
 pushed by Bastien to improve the agenda startup.

 This option, `org-agenda-inhibit-startup', is set by default to t so
 shouldn't have anything to configure.

 Thanks for your notice -- it could (have) help(ed)... if I wasn't already
 (quite) up-to-date.

 I must admit I did not see any improvement -- at least, even if I did not 
 make
 any measures before and after that, I did not feel any improvement.

 Per chance, you did not forget to M-x compile ? ;)

Good to remind me/us with that, but, once again, no, as I do not use compiled
Org files. That way, I'm sure not to forget such recompile step -- which I
would definitely do once in a while!

 Joking aside, I'm sad it didn't any sensible improvement.

Not for me. Not now, at least. But apparently well for others (Eric Fraga).

And, anyway, I'm always welcoming a lot any such effort to improve stuff, even
if that's not always visible as such.

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] How to improve Org startup time?

2013-01-29 Thread Nick Dokos
Sebastien Vauban wxhgmqzgw...@spammotel.com wrote:

  This may have something to do with my big amount of Org files in
  `org-agenda-files': 36 at this point. But is that so big??
 
  I don't think so.
 
 I'm sure it is, as I wrote (removed from the joined log) a message call
 before and after that line, and those time-stamps were 16 seconds one from the
 other.
 

Small misunderstanding here: the I don't think so was a reply
to the is that so big? question.

  Can you get a profile?
 
 You're right I should use real tools for that...
 
  M-x elp-instrument-package RET org-agenda RET
  M-x org-agenda-to-appt
  M-x elp-results
 
  In my (admittedly unchallenging, run-of-the-mill) setup, I get
  (with everything already loaded):
 
  org-agenda-to-appt1   
  0.053846964   0.053846964
  org-agenda-prepare-buffers1   
  0.028483817   0.028483817
  org-agenda-get-day-entries8   
  0.024222044   0.0030277555
  org-agenda-get-scheduled  8   
  0.0154506449  0.0019313306
  org-agenda-get-timestamps 8   
  0.004179949   0.0005224936
  org-agenda-skip   184 
  0.0027937810  1.518...e-05
  org-agenda-files  2   
  0.001386068   0.000693034
  org-agenda-get-deadlines  8   
  0.001288303   0.0001610378
  org-agenda-format-item22  
  0.0012140690  5.518...e-05
  org-agenda-get-blocks 8   
  0.0007851970  9.814...e-05
  org-agenda-new-marker 44  
  0.0006114019  1.389...e-05
  org-agenda-skip-eval  368 
  0.0001511950  4.108...e-07
  org-agenda-todayp 16  
  0.0001342800  8.392...e-06
  org-agenda-fix-displayed-tags 22  
  7.2914e-053.314...e-06
  org-agenda-get-category-icon  22  
  1.8382e-058.355...e-07
  org-agenda-time-of-day-to-ampm-maybe  6   
  3.347e-06 5.578...e-07
 
  A factor of 300: maybe it's real, but let's make sure first.

 Here it is. I don't know how to interpret that difference, tho.
 
 org-agenda-to-appt1   
 19.67319.673
 org-agenda-prepare-buffers1   
 18.86 18.86
 org-agenda-get-day-entries36  
 0.797000  0.022138
 org-agenda-files  37  
 0.544000  0.0147027027
 org-agenda-get-scheduled  36  
 0.515000  0.014305
 org-agenda-get-deadlines  36  
 0.158000  0.004388
 org-agenda-skip   612 
 0.141000  0.0002303921
 org-agenda-get-timestamps 36  
 0.047 0.001305
 org-agenda-get-blocks 36  
 0.046 0.001277
 org-agenda-format-item42  
 0.031 0.0007380952
 org-agenda-skip-eval  1204
 0.016 1.32...e-005
 org-agenda-fix-displayed-tags 42  0.0 
   0.0
 org-agenda-todayp 72  0.0 
   0.0
 org-agenda-new-marker 89  0.0 
   0.0
 org-agenda-deadline-face  2   0.0 
   0.0
 org-agenda-get-category-icon  42  0.0 
   0.0
 

Well, you have a bigger agenda by a factor of 4-5 and I guess a slower
machine, but it all takes less than a second except for one thing: the
big difference seems to be org-agend-prepare-buffers which
opens the files, reads them in and gets the buffers ready. 
Once the files are open however, they should be cached, so doing it
again should not take very long at all: is that the case?

If so, my guess is that either you have a very slow disk or you have
disk problems. Were things fast at some point in the past? In that case,
I would worry about the disk. Also, what happens if you copy your agenda
files to some other machine and try it there? If that's fast, then again
I would worry about this disk.

An anecdote to illustrate: at one point, it would take me a couple of
minutes to log in whereas previously it was a 

Re: [O] How to improve Org startup time?

2013-01-29 Thread Bastien


HI Sébastien,

Sebastien Vauban
wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org writes:

 In particular, you'll see that *16 seconds* are lost between 21:20:30 and
 21:20:46. They correspond to the executiong of just *one line*:

 #+begin_src emacs-lisp
   (org-agenda-to-appt)
 #+end_src

 This may have something to do with my big amount of Org files in
 `org-agenda-files': 36 at this point. But is that so big??

There are basically two factors that can slow down the agenda
generation: the number of agenda files, the number of entries
to check in all agenda files.

Can you compare the time spent by the initialization process
before and after commit 582cca5806 ?

It should improve things sensibly, I'd be curious to know
why it does not improve anything -- if that's the case.

Also, do you have any hooks in org-mode-hook?

Finally, org-agenda-to-appt is very slow by default, it
uses org-agenda-get-day-entries and check every entry...
see the docstring on how to make it check only the ones
you really need.

HTH!

-- 
 Bastien