From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#71179: [PATCH] In rgrep, check matching files before excluding files Date: Fri, 24 May 2024 23:45:00 +0300 Message-ID: <2c88f75b-6407-4eab-a5a5-0c16f005cd9f@gutov.dev> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16274"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: Spencer Baugh , 71179@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 24 22:46:26 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sAbo2-00047v-1x for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 24 May 2024 22:46:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAbnZ-00035G-1Z; Fri, 24 May 2024 16:45:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sAbnX-00032x-Nw for bug-gnu-emacs@gnu.org; Fri, 24 May 2024 16:45:55 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sAbnX-0004nQ-B3 for bug-gnu-emacs@gnu.org; Fri, 24 May 2024 16:45:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sAbnd-0006WV-PR for bug-gnu-emacs@gnu.org; Fri, 24 May 2024 16:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 May 2024 20:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71179 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 71179-submit@debbugs.gnu.org id=B71179.171658351825069 (code B ref 71179); Fri, 24 May 2024 20:46:01 +0000 Original-Received: (at 71179) by debbugs.gnu.org; 24 May 2024 20:45:18 +0000 Original-Received: from localhost ([127.0.0.1]:39102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sAbmv-0006WH-NH for submit@debbugs.gnu.org; Fri, 24 May 2024 16:45:17 -0400 Original-Received: from fhigh1-smtp.messagingengine.com ([103.168.172.152]:48995) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sAbmt-0006W6-Df for 71179@debbugs.gnu.org; Fri, 24 May 2024 16:45:16 -0400 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.nyi.internal (Postfix) with ESMTP id DA7681140157; Fri, 24 May 2024 16:45:02 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 24 May 2024 16:45:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1716583502; x=1716669902; bh=e7yDXM64Vzk8PvLCzeH7viB9ZKOj+5RXX5XMXQ+NRGU=; b= JTjWz+NtmY95YF1wrV1Z27Gt+BxGu7J7rchxvTLITBj1okBgwhkmSnYXYIag67fa ULY3Kw5V0YoQXMznkt3PxEFMHdxxUe9yXwxxRgvw4bRmBqDmJ/mCfq6+6/w/pZZS /5Ic/Se9bNpblNjEQvWUo6EzHJAXpZ05TygA30UiibKicWxQURv4aqmpcCWJjl2z /oeWb1tL6vY9+51pih9C2P9PgGHTN073T4dKE9+rzLY5mwNBuAFKj/vQ0f++L2db ijzI28w0LttgjdbdryTjAzpMm/j5Q89VN2TLSueymIrqJT1H2OJukBiEsGxvL55g 4gVEXs5GkyJA+wP+P2fQIA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1716583502; x= 1716669902; bh=e7yDXM64Vzk8PvLCzeH7viB9ZKOj+5RXX5XMXQ+NRGU=; b=U UB62+cHd9HsUlryQMg7ywkSWUmsdhPiAkmCpq1vEwX5HSEt9DMjBkiQrgrTlGJFy BDMoClTGj/FqEBpJzhvEPZY0cJIpP3uAXOdWefkFDJXsKhqq5tQhFjOsOdnXLA3O i5qRGIF7umfAvHEzxel7aNLkGWC8YK599qMJqpDn8bZ58pbORCbnd+weZj2tBcGr xGpWeaG91ziq7p4YXOS/V4q0285R9JOTAeiy9UgaR10b99/rD8lrx4wj+OUzY2iW p28nA11lHUZxu4TaTgeaxGbB8rx9DrsVzUZIXOnFpSprgpgdcGu832ToBuKCyHKG dJGkT3eACTHxDZKTy1xVw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeikedgudeglecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnheptdfhuedvtdevleegueelvedvjeevheffveevhedvuefftdefhfdvueeggfet gfdtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 24 May 2024 16:45:01 -0400 (EDT) Content-Language: en-US In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285801 Archived-At: Hi Spencer, On 24/05/2024 23:14, Spencer Baugh wrote: > If find checks the files glob first and then the excluding glob, it has > to do much less checking (since the files glob will substantially narrow > down the set of files on its own), and find performance is much better. > > In my benchmarking, this takes (rgrep "foo" "*.el" "~/src/emacs/trunk/") > from ~410ms to ~130ms. I can confirm improvement here (though not exactly 3x). 1.9s to 1.3s in a Linux checkout, for example. Nice. Moving the files exclude instructions to the placeholder is a slight incompatibility, but I wonder if there are any custom grep-find-template values which would be bothered by it (that's the only incompatibility I could think of). Perhaps those that currently don't include at all?