Subject: Re: bug#34343: [PATCH] Make project--find-regexp-in-files work with remote files

From: Dmitry Gutov <[email-masked]>
Date: Fri, 3 Jan 2020 03:52:27 +0300

On 02.01.2020 12:48, Michael Albinus wrote:
> Then I have removed everything from tramp-handle-file-remote-p which
> isn't necessary for the 'localname case, and I came to
>  ...
> I cannot confirm "twice as long". I've tried ...

My file names are longer still. I can give a specific example later, if 
you like.

> The difference is likely because tramp-file-name-regexp has been
> applied to a longer string.
> 
> If I simplify tramp-file-name-regexp, we get ...

Both are fine avenues for exploration, I think.

But most importantly for now: tramp-handle-file-remote-p does not take 
up the majority of time spent in file-remote-p. tramp-file-name-handler 
does:

ELISP> (benchmark 10000 '(file-remote-p "/ssh:[email-masked]:/%d"
                                  nil t))
"Elapsed time: 3.535115s (2.112970s in 27 GCs)"

ELISP> (benchmark 10000 '(tramp-handle-file-remote-p 
"/ssh:[email-masked]:/%d" nil t))
"Elapsed time: 0.780867s (0.645621s in 8 GCs)"

ELISP> (benchmark 10000 '(find-file-name-handler "/ssh:[email-masked]:/" 
'file-remote-p))
"Elapsed time: 0.070135s"

ELISP> (benchmark 10000 '(tramp-file-name-handler 'file-remote-p 
"/ssh:[email-masked]:/%d"  nil t))
"Elapsed time: 3.409674s (2.070461s in 27 GCs)"

And that function does a lot of things that I'm not sure we need to just 
get the remote id.