[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Bug: Caching org-publish-find-date [8.2.10 (release_8.2.10 @ /op

From: Nicolas Goaziou
Subject: Re: [O] Bug: Caching org-publish-find-date [8.2.10 (release_8.2.10 @ /opt/emacs/lisp/org/)]
Date: Wed, 27 Dec 2017 23:48:57 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)


Lorenzo Bolla <address@hidden> writes:

> When using `org-publish-project` I noticed that generating a sitemap
> sorted (anti-)chronologically is very slow. It turns out that the
> slowness is due to the sorting of sitemap entries, which calls
> `org-publish-find-date` during the comparison. But
> `org-publish-find-date` is not cached therefore it is called over and
> over for each file during the sorting process.
> By contrast, `org-publish-find-title` is cached and sorting
> alphabetically is faster.
> To test this assumption, I've modified `ox-publish.el` to cache
>    `org-publish-find-date`, too, obtaining a substantial speed-up:
>    (defun org-publish-find-date (file)
>      (or
>       (org-publish-cache-get-file-property file :date nil t)
>       (let ((date (org-publish-find-date-uncached file)))
>         (org-publish-cache-set-file-property file :date date)
>         date)))
>    (defun org-publish-find-date-uncached (file)
>      "Find the date of FILE in project.
>    This function assumes FILE is either a directory or an Org file.
>    If FILE is an Org file and provides a DATE keyword use it.  In
>    any other case use the file system's modification time.  Return
>    time in `current-time' format."
>    ...
> Is there a reason why we should not cache the date of a file, in the
> same way as we cache its title?

That's post-mature optimization. When only cache results of a function
when it is reported as horribly slow.

I added a cache for `org-publish-find-date' in master branch. Thank you.


Nicolas Goaziou

reply via email to

[Prev in Thread] Current Thread [Next in Thread]