Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > Firstly, I'll show some benchmarks > > ``` > ;; Emacs 29 branch > > (benchmark-run 10000 > (file-truename "~/Work/some/long/path/to/parse/that/is/very/deep/deep/deep/super/duper/deep/deep.el")) > ;; (1.810892642 1 0.051070616) > ... > Below are the profiles and the patch. On my system I needed to `ln -s > lisp/loadup.el .` to make it compile. Not sure if that is due to > differences between old and new `file-truename`, or something else. The profiles look fishy. For example, in emacs-30-before 73 15% - file-truename 73 is ~0.073 seconds, which cannot be right if you profiled the above `benchmark-run'. I tried to record the profiles on my side, using the above `benchmark-run' call, and what I am seeing is that most of the CPU time is already spend in C subrs: 1285 17% + file-name-nondirectory 1250 16% Automatic GC 1182 15% + file-symlink-p 1060 14% + file-name-case-insensitive-p 495 6% + find-file-name-handler 451 6% + file-name-as-directory 425 5% + file-name-directory 401 5% - directory-file-name 398 5% + setq I am attaching my profile, as saved via M-x profiler-report-write-profile. You can view it via M-x profile-report-find-profile At least, the number of calls to `file-name-nondirectory' can be trivially reduced in the `file-truename' code - it is called up to three times in a row.