GNU bug report logs -
#66117
30.0.50; `find-buffer-visiting' is slow when opening large number of buffers
Previous Next
Reported by: Ihor Radchenko <yantar92 <at> posteo.net>
Date: Wed, 20 Sep 2023 08:53:02 UTC
Severity: minor
Found in version 30.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
X-Debbugs-CC: Dmitry Gutov <dmitry <at> gutov.dev>
Hello,
Background: Some Org users (especially org-roam users) often complain
that Org agenda is very slow (sometimes, tens of seconds or minutes)
when running it right after startup. The cause is often not Org agenda
itself, but Emacs opening files slowly.
In some cases, the main reason files are opened slowly is user-defined
hooks or various packages adding advices mindlessly. However, Emacs
itself is also taking a significant fraction of time when opening a
large number of buffers.
I have recently got data on opening a large number of Org files in
Emacs that clearly demonstrates that `file-buffer-visiting' (and thus
`find-file') scale poorly when the number of buffers increases. This is
especially clear when Org mode needs to open several hundreds of
not-yet-opened Org files in a new Emacs session.
In the attached profile, ~500 Org buffers are being opened and calls to
`find-buffer-visiting' take 12.4 sec out of total 30.9 sec - 1/3 of all
the execution time. After replacing some of the calls to
`find-buffer-visiting' with `get-file-buffer', the total execution time
decreased to ~20 sec, confirming that `find-buffer-visiting' is
contributing significantly to slow performance.
Would it be possible to implement some kind of caching mechanism to be
used by `find-buffer-visiting'?
[org_agenda_profile_2 (application/octet-stream, attachment)]
[Message part 3 (text/plain, inline)]
In GNU Emacs 30.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version
3.24.38, cairo version 1.17.8) of 2023-09-19 built on localhost
Repository revision: 6721c616653279913f51f211b80614bff82c24c3
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
System Description: Gentoo Linux
--
Ihor Radchenko // yantar92,
Org mode contributor,
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>
This bug report was last modified 1 year and 136 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.