Michael Albinus <michael.albi...@gmx.de> writes: Hi,
>> Let me think over night, what we could do for checking (yes, I >> often >> have my best ideas in bed, when I cannot sleep :-) >> >> (I hate to wish someone a poor sleep… so: ) Enjoy your weekend, and >> thanks again! > > Thanks, more food for next nights :-) > > If you like, you can also instrument `tramp-handle-file-name-completion' > and `tramp-sh-handle-file-name-all-completions'. These are the two > working horses of Tramp for this task. My grand-daughter is delayed, so I could spend time for this. I have rewritten your test code to this: --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--- elp.el is a profiler, which does the same what you have done with your advices. Adding text to `unread-command-events' gives us more reproducibility for tests, we don't have to enter the string in minibuffer again and again. See the "\t" markers I have added. Running this code snippet, gives me --8<---------------cut here---------------start------------->8--- tramp-handle-file-name-completion 3 14.593368386 4.864456129 tramp-sh-handle-file-name-all-completions 4 13.569945073 3.3924862682 completion-all-completions 1 0.045356578 0.045356578 --8<---------------cut here---------------end--------------->8--- when running from the *scratch* buffer, and --8<---------------cut here---------------start------------->8--- tramp-handle-file-name-completion 3 7.354284338 2.4514281126 tramp-sh-handle-file-name-all-completions 4 6.3414164699 1.5853541174 completion-all-completions 1 0.047973254 0.047973254 --8<---------------cut here---------------end--------------->8--- when running from a remote buffer. This is with Emacs 27.2. When I use Emacs 28.0.50, the current development version, I get for the *scratch* buffer --8<---------------cut here---------------start------------->8--- tramp-handle-file-name-completion 3 8.882787691 2.9609292303 tramp-sh-handle-file-name-all-completions 4 7.8532386379 1.9633096594 completion-all-completions 1 0.033517331 0.033517331 --8<---------------cut here---------------end--------------->8--- and for a remote buffer --8<---------------cut here---------------start------------->8--- tramp-handle-file-name-completion 3 7.1762729730 2.3920909910 tramp-sh-handle-file-name-all-completions 4 6.1084943250 1.5271235812 completion-all-completions 1 0.06225497 0.06225497 --8<---------------cut here---------------end--------------->8--- Both results look close, so there seems to be an improvement. All tests performed with "emacs -Q". >> Best, >> JDS Best regards, Michael.