tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File path completions: strange speed discrepancy


From: JD Smith
Subject: Re: File path completions: strange speed discrepancy
Date: Sun, 19 Sep 2021 12:23:59 -0400


--8<---------------cut here---------------start------------->8---
(progn
 (require 'tramp-sh)
 (tramp-cleanup-all-connections)
 (elp-instrument-list '(completion-all-completions tramp-handle-file-name-completion tramp-sh-handle-file-name-all-completions))
 (setq unread-command-events (mapcar 'identity "///ssh:fencepost:/\tgd/g\tnuorg/\tcopyright.list\n"))
 (call-interactively #'find-file)
 (elp-results)
 (elp-reset-all))
--8<---------------cut here---------------end--------------->8---

Thanks very much for this much improved testing code (which also saves the tedium of slowly retyping!).  I altered it slightly to include a few more function, and target my local wired server:

(progn
 (require 'tramp-sh)
 (tramp-cleanup-all-connections)
 (elp-instrument-list '(file-exists-p completing-read read-file-name-internal read-file-name-default tramp-handle-file-name-completion tramp-sh-handle-file-name-all-completions))
 (setq unread-command-events (mapcar 'identity "///ssh:datpi:/home/pi/no\tex\t/do\tma\tce\t\n"))
 (call-interactively #'find-file)
 (elp-results)
 (elp-reset-all))

My timing results (emacs -Q, v27.2):

From *scratch*:

read-file-name-default                     1           6.600062      6.600062
completing-read                            1           6.507604      6.507604
read-file-name-internal                    17          1.386566      0.0815627058
tramp-handle-file-name-completion          6           0.771607      0.1286011666
tramp-sh-handle-file-name-all-completions  6           0.72563       0.1209383333
file-exists-p                              16          0.0443550000  0.0027721875

From remote dired:

read-file-name-default                     1           0.877973      0.877973
completing-read                            1           0.873579      0.873579
tramp-handle-file-name-completion          6           0.735771      0.1226284999
tramp-sh-handle-file-name-all-completions  6           0.716579      0.1194298333
read-file-name-internal                    17          0.039287      0.002311
file-exists-p                              16          0.0167529999  0.0010470624

So really only very little difference inside the tramp completion functions; they seem to be doing the same job independent of the starting point.  But the completing-read itself, which is where find-file is spending its time, is taking 8x longer!  And read-file-name-internal is 35x slower.  Do you find this as well?  I’ll dig a bit deeper and see if I can narrow it down further. 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]