GNU bug report logs - #51622
29.0.50; [PATCH] Abbreviate remote home directories in `abbreviate-file-name'

Previous Next

Package: emacs;

Reported by: Jim Porter <jporterbugs <at> gmail.com>

Date: Sat, 6 Nov 2021 03:45:02 UTC

Severity: wishlist

Tags: patch

Found in version 29.0.50

Fixed in version 29.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jim Porter <jporterbugs <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 51622 <at> debbugs.gnu.org
Subject: bug#51622: 29.0.50; [PATCH v2] Abbreviate remote home directories in `abbreviate-file-name'
Date: Mon, 8 Nov 2021 10:32:53 -0800
On 11/8/2021 7:58 AM, Michael Albinus wrote:
> Jim Porter <jporterbugs <at> gmail.com> writes:
>
>> I've attached the beginnings of a patch to do this. What do you think?
>> If the general idea makes sense, I'll finish it up and file a separate
>> bug to track it. If Tramp needs to perform the checks every time for
>> some remote hosts, maybe the user could set `tramp-case-insensitive'
>> to `never-cache' for those connections?
> 
> Before we start such changes, we should understand your case. Why is it
> computed every time? Why isn't the cached value used?

Thanks for the explanation above. It turns out I was just mistaken about 
what's happening. The check on the remote host *is* performed only once. 
Sorry for the confusion.

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 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. 
However, to make it easier to use correctly, I wanted to make sure 
`case-fold-search' was set based on `file-name-case-insensitive-p'. I 
only want to do that though if I can make that function fast enough that 
it doesn't show up near the top of a performance profile. Otherwise, 
I'll just try to keep the number of calls to 
`file-name-case-insensitive-p' to the bare minimum.)




This bug report was last modified 3 years and 187 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.