GNU bug report logs - #71179
[PATCH] In rgrep, check matching files before excluding files

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Fri, 24 May 2024 20:15:02 UTC

Severity: normal

Tags: patch

Fixed in version 30.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 71179 <at> debbugs.gnu.org
Subject: bug#71179: [PATCH] In rgrep, check matching files before excluding files
Date: Fri, 24 May 2024 16:54:37 -0400
Dmitry Gutov <dmitry <at> gutov.dev> writes:
> 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 <F> 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 <X> at all?

A grep-find-template that doesn't include <X> will indeed start seeing
ignores based on grep-find-ignored-files in rgrep.  But, such a user can
just set grep-find-ignored-files to nil and then they'll stop seeing
ignores again.

Also, for what it's worth, note that the documentation for
grep-find-template says this:

  <X> - find options to restrict or expand the directory list
  <F> - find options to limit the files matched

So this change makes the documentation more accurate: <X> previously
also affected the files matched, but now it only affects the directory
list, as documented.  <F> continues to limit the files matched, as
before.




This bug report was last modified 1 year and 40 days ago.

Previous Next


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