all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: 51622@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	[thread overview]
Message-ID: <493647c2-74af-52fc-d55e-42280e893694@gmail.com> (raw)
In-Reply-To: <87v912od0s.fsf@gmx.de>

On 11/8/2021 7:58 AM, Michael Albinus wrote:
> Jim Porter <jporterbugs@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.)





  reply	other threads:[~2021-11-08 18:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-06  3:44 bug#51622: 29.0.50; [PATCH] Abbreviate remote home directories in `abbreviate-file-name' Jim Porter
2021-11-06  8:06 ` Eli Zaretskii
2021-11-06 15:34 ` Michael Albinus
2021-11-06 16:38   ` Jim Porter
2021-11-06 17:41     ` Michael Albinus
2021-11-07  3:30       ` bug#51622: 29.0.50; [PATCH v2] " Jim Porter
2021-11-07 18:37         ` Michael Albinus
2021-11-08  4:54           ` Jim Porter
2021-11-08 15:58             ` Michael Albinus
2021-11-08 18:32               ` Jim Porter [this message]
2021-11-08 19:18                 ` Michael Albinus
2021-11-14  2:10           ` Jim Porter
2021-11-14 14:43             ` Michael Albinus
2021-11-15  6:58               ` bug#51622: 29.0.50; [PATCH v3] " Jim Porter
2021-11-15 16:59                 ` Michael Albinus
2021-11-16  1:14                   ` Jim Porter
2021-11-16 11:43                     ` Michael Albinus
2021-11-16 12:57                   ` 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=493647c2-74af-52fc-d55e-42280e893694@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=51622@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    /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.