emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: JI Xiang <hi@xiangji.me>
To: emacs-orgmode@gnu.org
Subject: Ridiculously long (2 minutes) startup time for org agenda
Date: Sun, 18 Feb 2018 13:38:42 +0100	[thread overview]
Message-ID: <54c5ef75-acac-22c6-9d6f-9b1399ce281d@xiangji.me> (raw)

Hello, first time posting on the mailing list. I encountered a problem 
where my agenda view (`C-c a a`) is taking ridiculously long (nearly 2 
minutes) to be shown the first time. From the second time onwards, the 
time is about 11 seconds, which is still very long by any means.

I wondered whether it has something to do with me having many files in 
the agenda list, so I tried to restrict the list to just one file. But 
still the first call to org-agenda-list took 12 seconds. This shouldn't 
be normal, right?

The following are shown in the `Messages` buffer during the call.

```
Press key for agenda command:
Restoring clock data
Loading /home/jx/.emacs.d/.cache/org-clock-save.el (source)...done
[yas] Prepared just-in-time loading of snippets successfully.
Importmagic and/or epc not found. importmagic.el will not be working.
Setting up indent for shell type zsh
Indentation variables are now local.
Indentation setup for shell type zsh
Using vacuous schema
Shell native completion is disabled, using fallback
```

I'm not sure why they would be there, especially the "using vacuous 
schema" and "shell native completion" part. Are the messages related to 
some `#BEGIN_SRC` blocks in the org files? I don't think I would ever 
need source code blocks when I'm viewing an agenda buffer?

I posted the question [on 
Emacs.SE](https://emacs.stackexchange.com/questions/30489/what-could-cause-org-agenda-to-take-very-long-to-start-up) 
and somebody suggested me use `elp-instrument` to perform a profiling. 
The results are as follows:

```

     Function Name, Call Count, Elapsed Time, Average Time

     org-agenda 1           116.6048159   116.6048159
     org-agenda-list 1           116.29427357  116.29427357
     org-agenda-prepare 1           109.15345470  109.15345470
     org-agenda-prepare-buffers 1           108.98258905  108.98258905
     org-agenda-get-day-entries 1288        7.0089191339  0.0054417074
     org-agenda-get-scheduled 1288        3.726361062   0.0028931374
     org-agenda-get-deadlines 1288        2.1579713230  0.0016754435
     org-agenda--timestamp-to-absolute 14544       1.1317418120  
7.781...e-05
     org-agenda-get-timestamps 1288        0.3673404320  0.0002852021
     org-agenda-get-sexps 1288        0.3438970410  0.0002670008
     org-agenda-get-restriction-and-command 1           0.310503975   
0.310503975
     org-agenda-get-blocks 1288        0.3083237900  0.0002393818
     org-agenda-prepare-window 1           0.157091024   0.157091024
     org-agenda-skip 8624        0.0781296389  9.059...e-06
     org-agenda-files 49          0.026090686   0.0005324629
     org-agenda-finalize 1           0.013325178   0.013325178
     org-agenda-mode 1           0.009848546   0.009848546
     org-agenda-finalize-entries 23          0.006178961   0.0002686504
     org-agenda-today-p 2604        0.0061717839  2.370...e-06
     org-agenda-skip-eval 16968       0.0052723920  3.107...e-07
     org-agenda-highlight-todo 112         0.0039840550  3.557...e-05
     org-agenda-format-item 112         0.0038309749  3.420...e-05
     org-agenda-new-marker 208         0.0031529359  1.515...e-05
     org-agenda-format-date-aligned 28          0.0007373120  2.633...e-05
     org-agenda-add-time-grid-maybe 28          0.0003810809  1.361...e-05
     org-agenda-fix-displayed-tags 112         0.000342384   3.057e-06
     org-agenda-fontify-priorities 1           0.00018465    0.00018465
     org-agenda-align-tags 1           0.000160119   0.000160119
     org-agenda-get-day-face 28          0.000156385   5.585...e-06
     org-agenda-get-category-icon 112         7.702...e-05  6.877...e-07
     org-agenda-span-name 23          4.4484e-05    1.934...e-06
     org-agenda-span-to-ndays 1           2.3496e-05    2.3496e-05
     org-agenda-fit-window-to-buffer 1           2.0877e-05    2.0877e-05
     org-agenda-time-of-day-to-ampm-maybe 21          1.124...e-05  
5.353...e-07
     org-agenda-set-mode-name 1           9.226e-06     9.226e-06
     org-agenda-mark-header-line 1           8.774e-06     8.774e-06
     org-agenda-reset-markers 1           4.829e-06     4.829e-06
     org-agenda-deadline-face 4           4.761e-06     1.19025e-06
     org-agenda-update-agenda-type 1           1.575e-06     1.575e-06
     org-agenda-ndays-to-span 2           1.174e-06     5.87e-07
     org-agenda-mark-clocking-task 1           7.16e-07      7.16e-07
     org-agenda-use-sticky-p 1           5.02e-07      5.02e-07
```

I'm not sure if that says much though.

Version information:

- Emacs: `GNU Emacs 27.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 
3.18.9) of 2018-02-18`

- Orgmode: `Org mode version 9.1.6 (9.1.6-44-ge6f891-elpaplus @ 
/home/jx/.emacs.d/elpa/develop/org-plus-contrib-20180205/)`.

- I'm using [Spacemacs'](https://github.com/syl20bnr/spacemacs) develop 
branch.

However, this problem happens on both Ubuntu 16.04 LTS and the latest 
MacOS. Actually it has persisted for a very long period of time so I 
doubt if it's related to any particular Emacs/Org version.

Any help would be much appreciated!

Best regards,

Xiang

             reply	other threads:[~2018-02-18 13:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-18 12:38 JI Xiang [this message]
2018-02-18 21:33 ` Ridiculously long (2 minutes) startup time for org agenda Thierry Banel
2018-02-19 19:49 ` Nick Dokos
  -- strict thread matches above, loose matches on Subject: below --
2018-02-19  1:00 JI Xiang
2018-02-26 16:29 ` Daniel Clemente
2018-03-12 12:29   ` JI Xiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54c5ef75-acac-22c6-9d6f-9b1399ce281d@xiangji.me \
    --to=hi@xiangji.me \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).