(setq remote-host "/sshx:jim@localhost:") (defun fill-directory-abbrev-alist (count) (setq directory-abbrev-alist (let (result) (dotimes (i count result) (setq result (cons (cons (format "\\`/home/abbr%d" (1+ i)) (format "/home/abbr%d" i)) result)))))) (defun run-test (count &optional path) (let* ((abbreviate-home-dir nil) (path (or path "/home/user/src/project")) (remote-path (concat remote-host path))) (benchmark 1000 `(abbreviate-file-name ,path)) (benchmark 1000 `(abbreviate-file-name ,remote-path)))) (find-file (concat remote-host "~")) (message "Empty `directory-abbrev-alist'") (run-test 1000) (message "") (fill-directory-abbrev-alist 100) (message "100 items in `directory-abbrev-alist' (no matches)") (run-test 1000) (message "") (message "100 items in `directory-abbrev-alist' (all matches)") (run-test 1000 "/home/abbr100/src/project") (message "") (fill-directory-abbrev-alist 500) (message "500 items in `directory-abbrev-alist' (no matches)") (run-test 1000) (message "") (message "500 items in `directory-abbrev-alist' (all matches)") (run-test 1000 "/home/abbr100/src/project")