From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#34343: [PATCH] Make project--find-regexp-in-files work with remote files Date: Wed, 01 Jan 2020 13:29:52 +0100 Message-ID: <87tv5fs6kf.fsf@gmx.de> References: <9d65284f-7a64-5e9c-ab02-fbbd1be41689@yandex.ru> <87r2bt1tio.fsf@gmx.de> <2cfd53b2-8202-a321-a853-da0c949b0f15@yandex.ru> <6cf8bfa8-3873-d3db-9139-854359027e8a@yandex.ru> <87h81mqiq5.fsf@gmx.de> <0ff03b20-20d8-b6c0-c876-3fd525586180@yandex.ru> <87mubdps6s.fsf@gmx.de> <87blrsz3tf.fsf@gmx.de> <87blrrmht9.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="60186"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: =?UTF-8?Q?Felici=C3=A1n_?= =?UTF-8?Q?N=C3=A9meth?= , 34343@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 01 13:31:34 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1imd9y-000FPH-4G for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 Jan 2020 13:31:34 +0100 Original-Received: from localhost ([::1]:58088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imd9w-0004DK-98 for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 Jan 2020 07:31:32 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32857) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imd9U-0004DB-E6 for bug-gnu-emacs@gnu.org; Wed, 01 Jan 2020 07:31:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imd9S-0007fb-Q6 for bug-gnu-emacs@gnu.org; Wed, 01 Jan 2020 07:31:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58058) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1imd9S-0007el-IL for bug-gnu-emacs@gnu.org; Wed, 01 Jan 2020 07:31:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1imd9S-00037C-CM for bug-gnu-emacs@gnu.org; Wed, 01 Jan 2020 07:31:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 Jan 2020 12:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34343 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 34343-submit@debbugs.gnu.org id=B34343.15778818038841 (code B ref 34343); Wed, 01 Jan 2020 12:31:02 +0000 Original-Received: (at 34343) by debbugs.gnu.org; 1 Jan 2020 12:30:03 +0000 Original-Received: from localhost ([127.0.0.1]:35795 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1imd8V-0002I2-0m for submit@debbugs.gnu.org; Wed, 01 Jan 2020 07:30:03 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:39873) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1imd8S-0002GS-JA for 34343@debbugs.gnu.org; Wed, 01 Jan 2020 07:30:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1577881793; bh=NWNIddce5MiNXEJZbnqxVFaBMUOf6N0usGCP0Usz1zA=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=GHSB6a9b5u5ULPon/0Si4SMeoOzcZRP19JCEMH5GFTqQXcP4VYOwliK6vtBbBmp9t /OerXw5RLUTE7orEhgb7Hfg+621sZ+H23Cex7wcgtk3saboy0WfaIIj+wlnzwce+l2 FI7XESmtjDuLaRCwtFhqb9dApApYelCSI1po+27E= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from detlef.gmx.de ([212.86.59.161]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M5QJD-1iloJw25X3-001TF2; Wed, 01 Jan 2020 13:29:53 +0100 In-Reply-To: (Dmitry Gutov's message of "Sun, 29 Dec 2019 16:14:01 +0300") X-Provags-ID: V03:K1:HKfWHobJa0vGXokqSQfZt9uqLypzAHMQ+JHgiks4ApXt2NTH+j3 mnYcLrGwVv0HgAvwT6oZ26V+koX7v52M9YWOeIZglagX6AFo1DpkqR++5rO0AZKQCrPFXNF Fzp4+T3KlyO/zLZzrekOHUxH6U2kDdSIA+YLgkXqrxtl1I9LZD8HrKUogX+340FUR2WzMGY LjyUw++s7e6YSBV2izx8Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:crxMrOe7RQg=:4qRfje82aSOHBKXCWe9Ke3 9TQX1/2Gjrx1Di5Qyba0F0C7msx9lVyMt59mh1ljRB9P2yETmoTlW56jGOoHfg0BK2I9qNqGU 74cOdpv50ZhKvkIF+108bdXcDpsiTJTJs4tXmFKYgiVxrq89jaVN7PviK4wpA1muBAXuBsuKB 1e3A5+0YEGwbE1nhgMEzU8Sd+jFoq0qUWagQu6Ae+L47HSrBfTaUEM9OqdW4XZFula3vHaHUG fQ5SwGU9q4LIibLhmFgJH28r252TO0O/Ybcw20bOsic36c405xePP+VjN997PPJH/L6Y754bP hDOIGNApgkwwDoLwQC5Am/qU5+zll6mmd5QAMzCvfufsuopWd6IoU3y8duXuYq8Wklj6GQ37x zPqQHiHKjWvoXFHOiwFYhs0WTixSsNVF9mKzVrQ4sfwe7fkWuRrzaA981C9Hkz8D9oihP27O2 dRcLJqb/0+6AaTKqV+8plAoV8ylSs+YTrYHpn2GD65SKgdMsnJ0G94o6eJZM9vWfy/Q7X4dyI KfcTs4fRXHkkdQrI3O4z2K5BF/NJKiVAcxsgljSjAUHKUPxS+JBgJdyA6G/LjNKY2Y6+rBEN6 UPYq3w5Nun6ickZYYIghwec1XgQX8jVCQ9ZVbNYQOBKqCtrcu0ZPDjVZTVcihzR/FmxmsmN50 Zthj6kloqbysmAjoGKLyPSHAEZXQN9CGZI/SYiOSTYJL0ol7iXb5bTCTlA3qrflBTpftG5n85 0/kTkisuNMSwTytcEFusmI1FVoMq7Vv4eNrh1r+Fr+9uojS/FC3djZ9HPNdE6q6RxdMhI9c7 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:174033 Archived-At: Dmitry Gutov 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.