Karthik Chikmagalur <karthikchikmaga...@gmail.com> writes:

> I'm attaching a profiler profile for one of these calls to
> `save-buffers-kill-emacs'.

Judging from the profile, most of the time is spent writing data.

> This is probably relevant: I am on Tecosaur's fork of Org mode,
>
> https://code.tecosaur.net/tec/org-mode
>
> which uses org-persist to cache LaTeX previews, and I generate many
> LaTeX previews in each Emacs session.  Here is where the preview data is
> cached:
>
> https://code.tecosaur.net/tec/org-mode/src/branch/dev/lisp/org-latex-preview.el#L2973

These caches should actually not (normally) contribute to time spent
before Emacs is closed. You are using file + elisp-data containers. file
container does nothing when the file is already stored in the
cache. elisp-data only writes to index file itself and not to cache.

So, some other parts of cache are taking time to write.
May you try setting `org-persist--report-time' to t and see what comes up?

> That said my org-persist-dir is only 44 MB in size, which isn't
> particularly large.  (A while ago we changed the cache method to only use
> org-persist to store the "final" version of each LaTeX fragment, and not
> all the intermediate previews generated when live-previewing.)

If it is 44Mb of Elisp data in a single file, it might take a while to
serialize it for Emacs. Especially in older Emacs versions where the
serializer is recursive.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to