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#51622: 29.0.50; [PATCH v2] Abbreviate remote home directories in `abbreviate-file-name' Date: Mon, 08 Nov 2021 20:18:45 +0100 Message-ID: <87r1bqo3qi.fsf@gmx.de> References: <5ac0b5f3-302c-2f96-771c-8d38088aa573@gmail.com> <87mtmhmh60.fsf@gmx.de> <87a6ihchbo.fsf@gmx.de> <87sfw7u7zw.fsf@gmx.de> <87v912od0s.fsf@gmx.de> <493647c2-74af-52fc-d55e-42280e893694@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6229"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 51622@debbugs.gnu.org To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 08 20:19:15 2021 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 1mkAAl-0001MI-0Q for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 08 Nov 2021 20:19:15 +0100 Original-Received: from localhost ([::1]:50052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkAAj-00070Q-1M for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 08 Nov 2021 14:19:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:60396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkAAY-00070G-Rn for bug-gnu-emacs@gnu.org; Mon, 08 Nov 2021 14:19:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47970) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mkAAY-0005q4-JK for bug-gnu-emacs@gnu.org; Mon, 08 Nov 2021 14:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mkAAY-0003D0-Fa for bug-gnu-emacs@gnu.org; Mon, 08 Nov 2021 14:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Nov 2021 19:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51622 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51622-submit@debbugs.gnu.org id=B51622.163639913712323 (code B ref 51622); Mon, 08 Nov 2021 19:19:02 +0000 Original-Received: (at 51622) by debbugs.gnu.org; 8 Nov 2021 19:18:57 +0000 Original-Received: from localhost ([127.0.0.1]:59516 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mkAAS-0003Cg-Te for submit@debbugs.gnu.org; Mon, 08 Nov 2021 14:18:57 -0500 Original-Received: from mout.gmx.net ([212.227.17.22]:44591) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mkAAP-0003CN-LZ for 51622@debbugs.gnu.org; Mon, 08 Nov 2021 14:18:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1636399126; bh=W4eh2l96Zz54CaKH1ituymRu4F+SDIRnW1e9Vsxazdc=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=YzDceEUUkD9/Rb27fdvmBdiqgPxOhZu3GGQ06XbgfZl44+2n45GCaWGGosR2qGbhZ 7yL/4NE5Su9Jlrw24UXgf4/WDxFRwAkMa0TIFs8fP0EACPajdVVPrmnJSnaO5IgwVL WoLdSm1BttT/1udcTWtnN5BR9vI6fUKon+DznDL8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([213.220.158.222]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MeCpb-1mCUAj2KcJ-00bLQn; Mon, 08 Nov 2021 20:18:46 +0100 In-Reply-To: <493647c2-74af-52fc-d55e-42280e893694@gmail.com> (Jim Porter's message of "Mon, 8 Nov 2021 10:32:53 -0800") X-Provags-ID: V03:K1:xz9KTL+VWU7K/QO/qJUvpL5QmV4B8nkLUGc73e3+vGX3xsOhwWz xwciLjrPt7oMu4TuPXHCrcUmR26lDB8A5wezYpbyBcnaE0gecZDHabl0WDcMlFO0Nwr1YC+ TRS69hpPm5K/GTLMi18bMiTFv0dMQZ8t87o4gamZLo4fBkZIAPelKbiKaqEuGDaghayFV1q Kfi7gf0RUNzzwpWB/zNYw== X-UI-Out-Filterresults: notjunk:1;V03:K0:8MWHlvP95D4=:id8gST3/ftfxd23DSt1mhW eZ5174aDiBNZc+4f5bh60g6toq0hK6H/Llq02rKpTWThaSUDZQL/oMhtRvfMI2qnOunX5cBII d5zwpgr9mPMhBH0k+dchCFrPBrn4oXt2zg56JnCHAYW+mkwUyQiPUs7E95ltpX0s0o9KS0dxn G2fi0zHrCKgMuqqjcxZRypk4WvU65tsOuOaUmV7BrfLvp/rz4C/YJ8HOMxupt+Wc4eywEM0Mm aCzLqJ6KGYs/NQk0e0jaXFu9yWmEG+Edbx54CYQPlzf8nFalhK/MhwHLiVZI+hcxnWOCCEB2O ZgJea1upOGluKnhJIud82mIAG4VtcdP1sqHPcU+kXcW14qnpVAw6JPgFSVLKxPZ2ytyI12kHx MZTdBD7Pn7Vt8ayqZFYQ4BXAfCRQZANx+AKhOoiRulxCIO38rUGKKDQ7ireM2EoGlY/X93A3s hsm7H03hMbchNjGvMCMf96ba0dWVSBm3Pqp0eMEEdKHSaQqr8CxWCbkriqS9dpEBfPOdk3hMs O4J0wTVk6W8diBEKYNg+yJIyeYri3dmJ8ppoQBmx1InrgCuV3IaETokIGM7gdTvYDW1IV5Ty4 bjStU6PHiCc7qrfKoCqKydLLC7pyN/tx9ROraDokGFZfSzRnx68jPRvWGD41R1XIL0+N5kfpY ATwFrEJMv8mTcxk5//fsZfAsoryxUGYBCUQ5n1KY6kbvQyCENdzWJ6wJM4bJgIYb6W02R0gOM 7Dv+AkFaXSKVYdQGGwPI/pJPai7fQM0Fgk4XMq6DgXsKKZVioGL+C1KWq2AKNSWHJKqg1FOV 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:219377 Archived-At: Jim Porter writes: Hi Jim, > If I profile `tramp-handle-file-name-case-insensitive-p' on Emacs 29 > master, I see that 52% of the time is spent in `file-remote-p' (and a > further 30% in `expand-file-name'). This is where the difference in > performance comes from; I don't think my patch helps with that, but > when testing, I eliminated the `file-remote-p' call (and the remote > check) and saw performance improve. I just got mixed up about what the > issue was. > > If the calls to `file-remote-p' and `expand-file-name' could be > optimized or replaced, that would make this function a lot > faster. I'll take a look at this and see what I can do to improve > things. If you have any suggestions though, I'm happy to hear about > them. The check (file-remote-p filename nil 'connected) is applied to prevent unintended work. It returns non-nil when there is already a connection to the remote host. The intention is to avoid, that `tramp-handle-file-name-case-insensitive-p' opens a new connection just in order to see, whether the remote file system is case insensitive. This is not needed when there's no connection yet. Hmm, we could replace this check by something cheaper: is there already a connection process? --8<---------------cut here---------------start------------->8--- (and (let ((non-essential t)) (tramp-connectable-p filename)) ... --8<---------------cut here---------------end--------------->8--- The `non-essential' variable must be bound to non-nil; otherwise `tramp-connectable-p' would always return non-nil. Does this help? In case of, you might offer a patch, with a comment why we don't use (file-remote-p filename nil 'connected) . For the `expand-file-name' case I have no offer yet. But let's see how the timing changes with that change above. Btw, when you run benchmark checks, you shall set (or let-bind) `tramp-verbose' to 0. Writing debug data has a cost. > (The main reason I'm digging into this right now is that you mentioned > it would be nice if we didn't have to copy-and-paste so much code from > `abbreviate-file-name'. I'm looking into making a new function called > something like `directory-abbrev-apply', which *only* does the > `directory-abbrev-alist' replacements so that Tramp can call > this. Good idea, I was also thinking about. For backward compatibility we will keep a mirror of that function in tramp-compat.el, until we support only Emacs 29+. Isn't this a glory future? :-) Best regards, Michael.