Stefan Monnier writes: >> Do I understand correctly that what is needed to implement your >> suggestion is >> >> 1. Remove case_fold_search_ slot from buffer objects >> 2. Use DEFVAR_LISP for case-fold-search >> 3. Declare case-fold-search buffer-local >> 4. Replace BVAR(...) references in C with Vcase_fold_search > > Yes (assuming that 3 refers to the use of `make-variable-buffer-local`). See the attached patch. I used my `find-buffer-visiting' benchmark (dolist (file (directory-files "/tmp/test/" t "txt")) (find-file-noselect file)) Without the patch: 10.3 sec With the patch: 7.0 sec Without the patch, the reverse profiler tree is 2728 26% Automatic GC 1187 11% + abbreviate-file-name ;; <--- 1080 10% + inhibit-local-variables-p ;; <--- 913 8% + uniquify-rationalize-file-buffer-names 816 7% + find-buffer-visiting 547 5% + locate-dominating-file With the patch, the `abbreviate-file-name' and `inhibit-local-variables-p' no longer appear on top 2559 35% Automatic GC 892 12% + uniquify-rationalize-file-buffer-names 704 9% + find-buffer-visiting 473 6% + locate-dominating-file 295 4% + dir-locals--all-files 241 3% + generate-new-buffer 219 3% + file-truename 169 2% + inhibit-local-variables-p 128 1% + abbreviate-file-name