Agenda speedup and optimization

Table of Contents

When your Org files grow, agenda generation may slow down.

Here are some tips on how to speed up the agenda generation. For those tips that depend on a specific version of Org, we mention this version.

Reduce the number of Org agenda files

The more agenda files, the more time it takes to check all of them before producing an agenda command. The older your hardrive is, the longer it takes to visit a file. Don't buy a new harddrive now! Just reduce the number of agenda files.

Also, don't forget that you can define the set of agenda files for each agenda custom command like this:

(setq org-agenda-custom-commands
      '((" " "Aujourd'hui" agenda "List of rendez-vous and tasks for today"
         ((org-agenda-files '("~/org/rdv.org" "~/org/bzg.org"))))))

Reduce the number of DONE and archived headlines

When matching against TODO-type tasks, Org will skip the ones marked as DONE or archived. If you have many DONE tasks and archived tasks in your file, better to store them in another file.

Inhibit the dimming of blocked tasks

By default org-agenda-dim-blocked-tasks is set to t, which will dim blocked tasks. For the agenda to get the relevant information, it needs to check against the headline up, and this takes time. If you don't need this feature globally or for a specific agenda, turning it off will speed up agenda generation.

Inhibit agenda files startup options (Org > 8.0)

When you run an agenda command, Org visits agenda files that are not yet visited. When finding a file for the first time, Org checks the startup options and apply them to the buffer: those options are either globally set through the org-startup-* variables or on a per-file basis through the #+STARTUP keyword.

Especially, Org will honor the startup visibility status, as set by org-startup-folded or #+STARTUP: folded.

This may slow down the operation of visiting a file very much, and the process of selecting agenda entries consequently.

To prevent agenda commands to honor startup options when visiting an agenda file for the first time, use this:

(setq org-agenda-inhibit-startup t)

The side-effect is that newly visited file will have all their headlines visible, but this speeds up agenda generation a lot when those files have many nested headlines.

Disable tag inheritance in agendas (Org > 8.0)

Defining inherited tags for a headline in the agenda takes time, because Org needs will grab inherited tags from higher level headlines.

Whether the agenda knows about inherited tags for each task depends on org-use-tag-inheritance and org-agenda-use-tag-inheritance:

  • org-use-tag-inheritance controls whether tags are inherited for tags-type agenda commands: tags, tags-todo and tags-tree. This variable also controls whether tags are inherited when running the command M-x org-sparse-tree RET in an Org buffer (hence the name of this variable, without the org-agenda- prefix.)
  • org-agenda-use-tag-inheritance controls whether tags are inherited for other agenda types too: todo, search, timeline, agenda.

    Generally, you want this variable to be nil, because the headlines on those agenda types don't depend on tags (and a fortiori on inherited ones.) Still, the default is to use tags in all agenda types, because org-agenda-show-inherited-tags needs to do the right thing by default.

What to do? If you don't need inherited tags in todo/search/timeline/agenda, just use this setting:

(setq org-agenda-use-tag-inheritance nil)

If you need tags in todo agendas only:

(setq org-agenda-use-tag-inheritance '(search timeline agenda))

You can also set this on a per-command basis:

(setq org-agenda-custom-commands
      '((" " "Aujourd'hui" agenda "List of rendez-vous and tasks for today"
         ((org-agenda-files '("~/org/rdv.org" "~/org/bzg.org"))
          (org-agenda-use-tag-inheritance nil)))))

Disable parsing for some drawer properties

Text properties are used to prepare buffers for effort estimates, appointments, and subtree-local categories in the agenda. If you don't use some of these agenda features, you can turn them off. Since using such drawer properties require a special scan before each new agenda command, this can lead to a speedup. For example

(setq org-agenda-ignore-drawer-properties '(effort appt category))

Documentation from the http://orgmode.org/worg/ website (either in its HTML format or in its Org format) is licensed under the GNU Free Documentation License version 1.3 or later. The code examples and css stylesheets are licensed under the GNU General Public License v3 or later.