GNU bug report logs - #34343
[PATCH] Make project--find-regexp-in-files work with remote files

Previous Next

Package: emacs;

Reported by: Felicián Németh <felician.nemeth <at> gmail.com>

Date: Wed, 6 Feb 2019 08:19:01 UTC

Severity: normal

Tags: moreinfo, patch

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 34343 <at> debbugs.gnu.org, Felicián Németh <felician.nemeth <at> gmail.com>
Subject: bug#34343: [PATCH] Make project--find-regexp-in-files work with remote files
Date: Wed, 01 Jan 2020 13:29:52 +0100
Dmitry Gutov <dgutov <at> yandex.ru> writes:

>> Not always. But even if it calls expand-file-name, this doesn't mean
>> always that a remote command is fired. This is what is expensive.
>
> That depends on our performance goals. As described in
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34343#29, when called on
> a lot of files, it can be fairly expensive even when offline.
>
> But eliminating remote calls will be a win, for sure.

I've played a little bit with this. Even if there is no remote file name
involved, file-local-name is slow due to the file-remote-p call and the
file name handler mechanery. See:

--8<---------------cut here---------------start------------->8---
(benchmark-run-compiled
    nil
  (dotimes (i 1000000) (format "/tmp/%d" i)))

=> (1.720033035 16 1.2495203040000007)
--8<---------------cut here---------------end--------------->8---

This is my initial example. Evall'ing `format' 1.000.000 times.

--8<---------------cut here---------------start------------->8---
(benchmark-run-compiled
    nil
  (dotimes (i 1000000) (file-local-name (format "/tmp/%d" i))))

=> (5.072258441 16 1.2559830709999957)
--8<---------------cut here---------------end--------------->8---

Although still a local file name, the elapsed time is about three times
as large in the initial example.

--8<---------------cut here---------------start------------->8---

(benchmark-run-compiled
    nil
  (let ((remote (file-remote-p  "/tmp")))
    (dotimes (i 1000000)
      (if remote
	  (file-local-name (format "%s/%d" remote i))
	(format "%s/%d" remote i)))))

=> (1.831333636 16 1.2604051830000103)
--8<---------------cut here---------------end--------------->8---

Refactoring the code, and applying `file-local-name' just to the cases
where it is needed, shows an elapsed time similar to the initial one.

Best regards, Michael.




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

Previous Next


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