From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs 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 Message-ID: <874jzyc9u9.fsf@gmx.de> References: <8735fjh5ge.fsf@gmx.de> <87v8sefl2f.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14910"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 56342@debbugs.gnu.org To: Paul Pogonyshev Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 03 20:48:21 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o84dp-0003kE-JZ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 03 Jul 2022 20:48:21 +0200 Original-Received: from localhost ([::1]:54596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o84do-0000c7-52 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 03 Jul 2022 14:48:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o84dW-0000bz-EA for bug-gnu-emacs@gnu.org; Sun, 03 Jul 2022 14:48:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51613) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o84dV-0002Fd-Tt for bug-gnu-emacs@gnu.org; Sun, 03 Jul 2022 14:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o84dV-0001rX-Ro for bug-gnu-emacs@gnu.org; Sun, 03 Jul 2022 14:48:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Jul 2022 18:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56342 X-GNU-PR-Package: emacs Original-Received: via spool by 56342-submit@debbugs.gnu.org id=B56342.16568740426982 (code B ref 56342); Sun, 03 Jul 2022 18:48:01 +0000 Original-Received: (at 56342) by debbugs.gnu.org; 3 Jul 2022 18:47:22 +0000 Original-Received: from localhost ([127.0.0.1]:45510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o84cs-0001oX-0n for submit@debbugs.gnu.org; Sun, 03 Jul 2022 14:47:22 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:36119) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o84cp-0001oJ-Gk for 56342@debbugs.gnu.org; Sun, 03 Jul 2022 14:47:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1656874032; bh=avHaiaUxfjUxgDetkRUCbin0jIBb51PTeasHARgeyTQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=S+JDwa4ssNjRTuhCM/1jgkTeTXOx87xGU8wN1tltfayAb/GaWnBiHAgwjqeef0+4E ljgaZcLqUQfr2JxXuY3PHjuNPbenVf7EYbXpC6Ct9id5PgkZ1ywPSOyIIT7IlcxRyw pJAQIvoRBTz1Rg0dNZ+2ro8JLFiAxU3+wjrJP+yM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([213.220.148.177]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N6KUd-1nWBi50iU5-016dK6; Sun, 03 Jul 2022 20:47:12 +0200 In-Reply-To: (Paul Pogonyshev's message of "Sun, 3 Jul 2022 16:00:41 +0200") X-Provags-ID: V03:K1:AXFntJXEX1BgdvCrzNfIfkOe393XcCFTQneHiG9OsRjupM0OQvb TSr/L3wKL4esZTb4vV8swdG/tnoGpe1Zmr3/cxXFUXXHrpTxAPKaieDIhXiFw/GqTK0Wm16 yO8v6QS4b0szZbhd+pquri23pCr9QQBTFUNQFSXvG4JuEvKdJF75hGXkYWIWSHcXJ4c7RHd USvQmw4JBkPT8sjfMahWg== X-UI-Out-Filterresults: notjunk:1;V03:K0:hN7A+WAmyrs=:Gf29JUJT7XqHPRFolhI0yW PP5SKT26g5NUGLy3un6yPfsNL350DIxGSB3E5Fcfr+sv/3JgJ1x/oyUJZgt7FGxjnzGiY5TgX ORVfXPn+kWr2odiCTsknZwTEJ63A3G2DJrQjPSVsDKw4MS6SkD7LzMCcgRNf9AAn3bpJqqCOQ 6EKlXiPS4BfGyGL/YIsVRnWyG5OabPPQT34B9hl+BRCaRFLyKncZepu1kREgV8AAsAX5Tzz4R VWMcc4iGFe0QkA3QJm3krz9bT0DUDc5qINbUqzjP0IS5+tEtZ1njLAzwPxo2b6Q+sJzUQ11om mMda0lfQE2/oxFsbiGIox6CDHv/WSw4UfirsmN/+eXfRDcKJ7VNGMFqZNQ4aisGM5nyWheXsM AGzL/Io0tSJECSvcFND2sACKi4bsKZVO6SptJGom3emuk2s2jzGajhnaOq0bg11lgjJlwPDyQ eL8out5lpHK1Z1mMhdhTzOhkrP/tYpCakhqxP+CpVL7FOAmXwAA6i29odxQ3zQdkvqZG4Rb2k 1lYf9OZCKHmzCepUgPVpj4y1/SrvMXbHgCoscQfSeLbinsyRQAvh4ZXelBdxjMwtShZJl3Izh aADwEcpiDPpw4fzxNUdynG/IVHAF6LpJ5+WTiW0rkQE0JT0DOQig2DxlUohIOnmSVeqSn5oTD zAH7HQG21FDRq23MboOOnjX9iJbRR143T/3+OomGRLElYipVoYpkdrEW+Bce2iuBPdTOeRp1U z68Ca/RcC0X6zR1j9H7FHEDV9F/wgAoo9XvuNNdVn7RQoBqCkbTRThnaR+BxADa7kI+I7aQP X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:236020 Archived-At: Paul Pogonyshev 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.