unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Michael Albinus <michael.albinus@gmx.de>
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: Tue, 7 Jan 2020 06:23:45 +0300	[thread overview]
Message-ID: <10dbccdd-99e8-883b-01e6-e8d3bc1e195e@yandex.ru> (raw)
In-Reply-To: <87y2ukjuan.fsf@gmx.de>

On 06.01.2020 20:48, Michael Albinus wrote:
> Dmitry Gutov <dgutov@yandex.ru> writes:
> 
>> Hi Michael,
> 
> Hi Dmitry,
> 
>> As I've shown before, the generic dispatch is far from being the
>> bottleneck at the moment. tramp-file-name-handler doing a lot of
>> unrelated work is what takes the most time.
> 
> It might be unrelated to yozur use case.

As far as I can tell, it's unrelated to 'file-local-name' altogether, 
not just my use case.

> But tramp-file-name-handler is
> the central heart of Tramp's file name handling. It ensures that the
> proper function is called; that a Tramp subpackage is autoloaded if
> needed; that there are no blocking situations due to simultaneous
> invocations from timers, filters, sentinels; that there are no
> unintended infloops; that Tramp events and errors are caught etc pp. In
> the Tramp repository, it is also responsible for thread handling. All of
> this must be applied for every file name operation, also for
> file-remote-p, even if you don't need some of this in your use case.

I believe it's an incidental detail that file-local-name is implemented 
through file-remote-p. Maybe we could also introduce a new operation as 
well.

>>> In case you want to go your own path, I could provide you an own
>>> tramp-file-local-name function, which bypasses this mechanism:
> 
> That's why I have provided this function. In order to avoid a call of
> file-local-name (which implies the call of file-remote-p).

I can use it, and I will if I can't convince you otherwise, but we *can* 
keep operation both fast and generic at the same time, so... why not, 
really?

> No. file-remote-p must pass the whole machinery. It isn't called only
> for your use case.

Hence the double check which verifies that the second argument is 
'localname'.

> And if we start such bypassing for a file name operation, we will end in
> unmaintainability soon. Over the years, there has been often the
> temptation to bypass this or that file name operation, similar to your
> approach. Sometimes I even did, but soon I have reverted such
> exceptions. Tramp isn't maintainable any longer, if we introduce such
> coding style. Subtle errors you have no idea where they come from.

It's up to you, but having an alist of exceptions should be both 
maintainable and readable. Like most other file handlers do (e.g. 
epa-file-handler) which maintain mappings of operations to functions.

> In general, there's no problem calling tramp-file-name-handler, because
> the remote operations take much more time. This machinery is neglectable
> then. Your use case is different, because you do not trigger any remote
> operation.

Would any use of file-local-name trigger a remote operation?

>> P.S. BTW, I think our convention is not to call save-match-data unless
>> obviously required. If the caller needs to save the match data, it
>> will use it itself.
> 
> Well, as you might have seen with my recent commit in master, I intend
> to use tramp-file-local-name internally. At some places it seems to be
> necessary to protect match data.

Not in the case of the new proposed use in project.el either.

Anyway, the idea is only to do that where necessary to squeeze just a 
little bit of more performance in places that don't need to protect 
match data.





  reply	other threads:[~2020-01-07  3:23 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
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 [this message]
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=10dbccdd-99e8-883b-01e6-e8d3bc1e195e@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=34343@debbugs.gnu.org \
    --cc=felician.nemeth@gmail.com \
    --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 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).