all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Paul Pogonyshev <pogonyshev@gmail.com>
Cc: 56342@debbugs.gnu.org
Subject: bug#56342: TRAMP (sh) issues way too many commands, thus being very slow over high-ping networks
Date: Sun, 03 Jul 2022 20:47:10 +0200	[thread overview]
Message-ID: <874jzyc9u9.fsf@gmx.de> (raw)
In-Reply-To: <CAG7Bpap0NmMvc+tfJ5v4K-XJrXv0s6MaRo_WgdBDi8hzytsoyg@mail.gmail.com> (Paul Pogonyshev's message of "Sun, 3 Jul 2022 16:00:41 +0200")

Paul Pogonyshev <pogonyshev@gmail.com> writes:

Hi Paul,

> Maybe you could then single out commands that are supposed to return
> result nearly-instantly anyway, e.g. `stat' or `test' (though the
> latter I have suggested to replace with `stat' before). If they fail
> to produce the result in 10 seconds, the connection can be assumed
> dead, just as with `echo are you awake'. Commands that involve
> transmitting (potentially) large amount of data this or that way can
> work as now. So, you would usually avoid one extra command (which with
> a high ping means sth. like 0.2 s, already pretty noticeable in UI)
> and achieve the same result.
>
> Sanity checks are good. but not if they visibly slow down normal
> operation.

I will see whether I can do something along these lines.

> It might be easier to convince the rest of Emacs developers to use an
> extra variable to possibly skip `file-exists-p' on only remote files
> than to remove the call altogether. Though in either case it is
> required that `file-missing' error is handled properly which is,
> incidentally, easier to test if the call to `file-exists-p' is
> dropped. A target here would be `insert-file-contents' and whatever it
> calls, and this is a part of Emacs, not some external library.

Tramp has an own implementation of insert-file-contents, called
tramp-handle-insert-file-contents. And indeed, file-exists-p is called
in order to raise the file-missing error if needed. I have no idea how
we could generate this otherwise. Perhaps changing the order: First try
to insert the file contents, and if this errs out, a call with
file-exists-p in order to raise the error. I'll play with this.

OTOH, with longer cache expiration time (see below), file-exists-p
doesn't cost a roundtrip.

> Yet another idea: removing temporary should be done asynchronously (I
> haven't checked, maybe it's already the case, but likely not). The
> caller doesn't really care about call result and even if it has
> succeeded. Again, not sure if this is easy to achieve interface-wise,
> maybe it's from a higher level. But I suspect it's something like
> `with-temp-file' and can be optimized: one-time optimization are worth
> it even if that costs readability.

Doing it asynchronously would require a second connection to the remote
host. Performance would rather degrade.

One thing you could do w/o code change is to change the value of
remote-file-name-inhibit-cache. Its default value is 10, meaning caches
expire already after 10 seconds. With your slow connection, a higher
value should help already.

> Paul

Best regards, Michael.





  reply	other threads:[~2022-07-03 18:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01 17:14 bug#56342: TRAMP (sh) issues way too many commands, thus being very slow over high-ping networks Paul Pogonyshev
2022-07-02 15:58 ` Michael Albinus
2022-07-02 18:14   ` Paul Pogonyshev
2022-07-03 12:16     ` Michael Albinus
2022-07-03 14:00       ` Paul Pogonyshev
2022-07-03 18:47         ` Michael Albinus [this message]
2022-07-03 19:52           ` Paul Pogonyshev
2022-07-04 11:19             ` Michael Albinus
2022-07-04 14:42               ` Paul Pogonyshev
2022-07-04 16:30                 ` Michael Albinus
2022-07-26  8:00                   ` Paul Pogonyshev
2022-07-26 14:18                     ` Michael Albinus
2022-07-26 16:17                       ` Paul Pogonyshev
2022-07-26 17:51                         ` Michael Albinus
2022-08-01 20:20                           ` Paul Pogonyshev
2022-08-02 14:23                             ` Michael Albinus
2024-05-20  0:04                               ` Dmitry Gutov
2022-07-04 10:33   ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874jzyc9u9.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=56342@debbugs.gnu.org \
    --cc=pogonyshev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.