Support via Liberapay

Agenda speedup and optimization

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. When Emacs opens a new file, it may do a lot of work, like activating all kinds of minor modes you installed - it can take a considerable time when the number of agenda files is in hundreds1.

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/" "~/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.



Emacs 30 is somewhat better in opening large number of files, but will still take a long time when the number of agenda files is over a thousand.

Documentation from the 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.