From: Michael Albinus <michael.albinus@gmx.de>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: "Felicián Németh" <felician.nemeth@gmail.com>, 34343@debbugs.gnu.org
Subject: bug#34343: [PATCH] Make project--find-regexp-in-files work with remote files
Date: Wed, 01 Jan 2020 13:29:52 +0100 [thread overview]
Message-ID: <87tv5fs6kf.fsf@gmx.de> (raw)
In-Reply-To: <e95d5af5-ea07-68b1-4168-ef117f9dec06@yandex.ru> (Dmitry Gutov's message of "Sun, 29 Dec 2019 16:14:01 +0300")
Dmitry Gutov <dgutov@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.
next prev parent reply other threads:[~2020-01-01 12:29 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-06 8:18 bug#34343: [PATCH] Make project--find-regexp-in-files work with remote files Felicián Németh
2019-02-14 1:17 ` Dmitry Gutov
2019-02-15 18:53 ` Felicián Németh
[not found] ` <a54e7498-4ead-dd6f-6a2e-3919ab035b23@yandex.ru>
2019-02-27 9:15 ` Michael Albinus
2019-03-06 7:47 ` Felicián Németh
2019-03-06 14:33 ` Dmitry Gutov
2019-03-06 14:44 ` Dmitry Gutov
2019-03-08 8:28 ` Felicián Németh
2019-12-26 14:04 ` Dmitry Gutov
2019-12-27 8:24 ` Michael Albinus
2019-12-27 14:18 ` Dmitry Gutov
2019-12-27 17:57 ` Michael Albinus
2019-12-28 10:21 ` Michael Albinus
2019-12-28 14:48 ` Dmitry Gutov
2019-12-28 18:56 ` Michael Albinus
2019-12-28 14:46 ` Dmitry Gutov
2019-12-28 18:46 ` Michael Albinus
2019-12-29 0:15 ` Dmitry Gutov
2019-12-29 12:34 ` Michael Albinus
2019-12-29 13:14 ` Dmitry Gutov
2020-01-01 12:29 ` Michael Albinus [this message]
2020-01-02 1:22 ` Dmitry Gutov
2020-01-02 10:48 ` Michael Albinus
2020-01-03 0:52 ` Dmitry Gutov
2020-01-03 9:28 ` Michael Albinus
2020-01-06 14:33 ` Dmitry Gutov
2020-01-06 18:48 ` Michael Albinus
2020-01-07 3:23 ` Dmitry Gutov
2020-01-07 9:19 ` Michael Albinus
2020-01-07 13:40 ` Dmitry Gutov
2020-01-07 14:29 ` Michael Albinus
2020-01-07 14:34 ` Dmitry Gutov
2021-07-22 13:00 ` Lars Ingebrigtsen
2021-07-24 19:42 ` Dmitry Gutov
2021-07-25 6:41 ` Lars Ingebrigtsen
2020-01-03 0:57 ` Dmitry Gutov
2020-01-06 17:29 ` Felician Nemeth
2020-01-07 3:23 ` Dmitry Gutov
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tv5fs6kf.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=34343@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
--cc=felician.nemeth@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).