Make timestamp search in org-entry-properties more efficient.
commit4760c3b9482cfeda02d24590e2fb7c70a9c1d0cd
authorMatt Lundin <mdl@imapmail.org>
Mon, 13 Dec 2010 08:05:46 +0000 (13 08:05 +0000)
committerCarsten Dominik <carsten.dominik@gmail.com>
Mon, 13 Dec 2010 14:13:36 +0000 (13 15:13 +0100)
tree1c9e45e32467a9b9f884a1ad9f317cb981dcf816
parent98015f37483c7390d6a426d248527673f38633ac
Make timestamp search in org-entry-properties more efficient.

* lisp/org.el: (org-entry-properties) Stop scanning for timestamps if
a specific timestamp property (e.g., DEADLINE, SCHEDULED, etc.) is
requested and a match is found. Also, if a specific timestamp property
is requested, do not push non-relevant timestamps onto property list.

This change only effects org-entry-properties when a specific
timestamp is requested with the special flag, as in:

(org-entry-properties nil 'special "SCHEDULED")

Previously, even if only the SCHEDULED timestamp was requested,
org-entry-properties would parse all the timestamps in an entry. This
extra parsing could slow down the construction of agenda views,
especially with entries that contained a large number of log
items (CLOCK, state changes, etc.). The function org-entry-get,
however, is only interested in the first occurrence of the item. When
looking for a specific type of timestamp, org-entry-properties now
stops searching for timestamps after the match is found, unless the
property is "CLOCK".

Here are the relevant ELP results:

Before:

org-entry-get      296         0.4724579999  0.0015961418
org-entry-properties 31          0.3438769999  0.0110928064

After:

org-entry-get        296         0.1447729999  0.0004890979
org-entry-properties 31          0.015765      0.0005085483
lisp/org.el