From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lorenzo Bolla Subject: Bug: Caching org-publish-find-date [8.2.10 (release_8.2.10 @ /opt/emacs/lisp/org/)] Date: Wed, 27 Dec 2017 16:54:49 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a114162d0eb459a056155414e" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eUEyi-0005GG-9J for emacs-orgmode@gnu.org; Wed, 27 Dec 2017 11:54:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eUEyh-0004cY-3l for emacs-orgmode@gnu.org; Wed, 27 Dec 2017 11:54:52 -0500 Received: from mail-vk0-x22f.google.com ([2607:f8b0:400c:c05::22f]:45332) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eUEyg-0004c4-Sg for emacs-orgmode@gnu.org; Wed, 27 Dec 2017 11:54:51 -0500 Received: by mail-vk0-x22f.google.com with SMTP id o16so23318959vke.12 for ; Wed, 27 Dec 2017 08:54:50 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --001a114162d0eb459a056155414e Content-Type: text/plain; charset="UTF-8" Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See http://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org-mode mailing list. ------------------------------------------------------------------------ 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? Thanks, Lorenzo Emacs : GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23) of 2016-11-01 Package: Org-mode version 8.2.10 (release_8.2.10 @ /opt/emacs/lisp/org/) --001a114162d0eb459a056155414e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Remember to cover the basics, that is, what you expect= ed to happen and
what in fact did happen.=C2=A0 You don't know how t= o make a good report?=C2=A0 See

=C2=A0=C2=A0=C2=A0=C2=A0 http://orgmode.org/manual= /Feedback.html#Feedback

Your bug report will be posted to the Or= g-mode mailing list.
---------------------------------------------------= ---------------------

When using `org-publish-project` I noticed tha= t generating a sitemap
sorted (anti-)chronologically is very slow. It tu= rns out that the
slowness is due to the sorting of sitemap entries, whic= h calls
`org-publish-find-date` during the comparison. But
`org-publi= sh-find-date` is not cached therefore it is called over and
over for eac= h file during the sorting process.
By contrast, `org-publish-find-title`= is cached and sorting
alphabetically is faster.

To test this ass= umption, I've modified `ox-publish.el` to cache
=C2=A0=C2=A0 `org-pu= blish-find-date`, too, obtaining a substantial speed-up:

=C2=A0=C2= =A0 (defun org-publish-find-date (file)
=C2=A0=C2=A0=C2=A0=C2=A0 (or
= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (org-publish-cache-get-file-property file :d= ate nil t)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (let ((date (org-publish-find-= date-uncached file)))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (org-pu= blish-cache-set-file-property file :date date)
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 date)))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
=C2=A0=C2= =A0 (defun org-publish-find-date-uncached (file)
=C2=A0=C2=A0=C2=A0=C2= =A0 "Find the date of FILE in project.
=C2=A0=C2=A0 This function a= ssumes FILE is either a directory or an Org file.
=C2=A0=C2=A0 If FILE i= s an Org file and provides a DATE keyword use it.=C2=A0 In
=C2=A0=C2=A0 = any other case use the file system's modification time.=C2=A0 Return=C2=A0=C2=A0 time in `current-time' format."
=C2=A0=C2=A0 ...<= br>
Is there a reason why we should not cache the date of a file, in the=
same way as we cache its title?

Thanks,
Lorenzo

Emacs= =C2=A0 : GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23)<= br>=C2=A0of 2016-11-01
Package: Org-mode version 8.2.10 (release_8.2.10 = @ /opt/emacs/lisp/org/)

--001a114162d0eb459a056155414e--