Eli Zaretskii writes: > My advice is to have a prototype working, then time it on local > filesystems. See the attached patch. I used the following simplified reproducer that does not involve loading Org (which skews the relative numbers as Org loading is relatively slow): (dotimes (i 1000) (with-temp-file (format "/tmp/test/%d.txt" i) (insert "* This is test"))) (dolist (file (directory-files "/tmp/test/" t "txt")) (find-file-noselect file)) Without the patch (cpu-profiler-without-patch): 4.3 sec With the patch (cpu-profiler-w-patch ): 2.5 sec > ... Optimizing for networked filesystems is the next step, > assuming it is needed. Please keep in mind that the current code does > that as well, only from Lisp: the call to file-attributes calls > 'stat', then conses the 11-member list that is the return value. So > the C implementation cannot possibly be worse. I left the `file-attributes' call in Elisp. Looking at the cpu-profiler-w-patch, `find-buffer-visiting' is no longer the main contributor to CPU time. I am not sure if we really need to squeeze the performance yet further from `find-buffer-visiting' - `file-attributes' is taking pretty much no time: (reverse call-tree) 924 36% Automatic GC 173 6% + inhibit-local-variables-p 172 6% + locate-dominating-file 139 5% + abbreviate-file-name 113 4% + dir-locals--all-files 109 4% + file-truename 92 3% + find-buffer-visiting ... 6 0% + file-attributes comapare with cpu-profiler-without-patch: (reverse call-tree) 1714 39% + find-buffer-visiting 1131 26% Automatic GC 202 4% + locate-dominating-file 147 3% + abbreviate-file-name 140 3% + inhibit-local-variables-p 104 2% + dir-locals--all-files 98 2% + uniquify-rationalize-file-buffer-names 91 2% + file-truename