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

From: Dmitry Gutov <[email-masked]>
Date: Thu, 26 Dec 2019 16:04:01 +0200

On 08.03.2019 10:28, Felicián Németh wrote:
> Hi Dmitry,
> 
> I forgot that project-files are new in emacs-27, so there's no need to
> worry about backward compatibility.  Also, there is no need to hurry
> either, because emacs-27 won't be released soon.

Emacs 27 is approaching now. :-)

>> So I wonder if somebody has an opinion on that. Maybe we'll want to
>> include remote files as "external roots" in some projects? Or files
>> inside archives?
> 
> I never worked on a project with multiple remote-ids.  However, if we
> can come up with something simple that does not have significant
> performance impact on the local case, we should solve the general case,
> I think.  Remote operations tend to be slow, so I think project.el can
> run more complex algorithms in that case.

I've done some benchmarking. If the project is big (e.g. gecko-dev with 
200000+ files), and it resides locally, and the hdd is fast, and we can 
fetch the list of files quickly (i.e. it uses Git),

   (seq-group-by #'file-remote-p all-files)

is pretty slow.

For instance, in that example on my machine,

   (project-files (project-current))

takes 1.6s.

And

   (seq-group-by #'file-remote-p all-files)

itself takes 1s, and

   (mapcar #'file-local-name files))

takes another 0.9s. While Xargs+Grep only take another 3-4 seconds. So 
overall the remoteness processing takes a significant portion of the 
time in the local case even if we do it the smart way (e.g. avoid 
mapping through #'file-local-name if remote-id is nil).

So I've pushed a more simplistic patch to emacs-27 (commit be38e39fcc).

Felicián and Michael, please take a look.