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: Mon, 20 Sep 2021 14:31:01 -0400


Furthermore, I have switched to a remote machine in my LAN, because it
doesn't matter whether the machine is far away. So I have changed the
code snippet to

(progn
 (require 'tramp-sh)
 (defun my/test ()
   (interactive)
   (tramp-cleanup-all-connections)
   (elp-instrument-list
    (append
     '(completion-file-name-table
completion--sifn-requote
completion--file-name-table
completing-read
read-file-name-internal
read-file-name-default)
     (mapcar #'intern (all-completions "tramp-handle-" obarray 'functionp))
     (mapcar #'intern (all-completions "tramp-sh-handle-" obarray 'functionp))))
   (setq unread-command-events
 (mapcar 'identity "///ssh:detlef:/hom\talbin\tsr\temacs\t/lisp/\t\n"))
   (call-interactively #'find-file)
   (let ((elp-recycle-buffers-p nil))
     (elp-results)
     (elp-reset-all)))

 (dolist (df '("/ssh::" "/"))
   (let ((default-directory df))
     (my/test))))

Thanks for this.  The final bit of your updated test unfortunately does not work for me, as it tries and fails to open a connection to my local machine for some reason (“Could not resolve hostname”).

But just running my/test from *scratch*, and then again from a dired buffer on the remote host (another server this time, also wired), yields the attached results, in graphical form this time.  As you can see, in the worst case, the performance per call is >100x worse.

One additional bit of data: on my MacOS terminal, when a running process (here emacs -Q) spawns any sub-processes, the name of the sub-process appears in the terminal window title.  I have noticed that, while performing our test from *scratch*, the title flashes wildly for the full ~9 seconds of the test, mentioning “launchctl” and “date” and others, over and over.  These appear perhaps a dozen or more times.  Conversely, when running my/test from the remote dired buffer, it is updated almost not at all (maybe “gzip” for the final file transfer?... it goes by fast).

So I’d conjecture the root cause of the discrepancy here is that there’s some real difference in how and how often external processes are being spawned, between local and remote starting points.  

To check into this, I advised call-process, to report on which processes are being made.  But this looks… identical, except the fast version spawns my zsh shell to collect DARWIN_USER_TEMP_DIR even more often (134 times!)!  Somehow the processes have to be involved though...

Attachment: tramp_local_remote.pdf
Description: Adobe PDF document







reply via email to

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