X-Debbugs-CC: Dmitry Gutov 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'?