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: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Spencer Baugh <sbaugh <at> janestreet.com>
Subject: bug#71179: closed (Re: bug#71179: [PATCH] In rgrep, check
 matching files before excluding files)
Date: Sun, 02 Jun 2024 10:48:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#71179: [PATCH] In rgrep, check matching files before excluding files

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 71179 <at> debbugs.gnu.org.

-- 
71179: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71179
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Spencer Baugh <sbaugh <at> janestreet.com>
Cc: dmitry <at> gutov.dev, 71179-done <at> debbugs.gnu.org
Subject: Re: bug#71179: [PATCH] In rgrep, check matching files before
 excluding files
Date: Sun, 2 Jun 2024 03:46:09 -0700
Version: 30.1

Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks, this LGTM.

Same here, so pushed to master as commit b71fa27987d and closing the bug.

Thanks, Spencer.

[Message part 3 (message/rfc822, inline)]
From: Spencer Baugh <sbaugh <at> janestreet.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] In rgrep, check matching files before excluding files
Date: Fri, 24 May 2024 16:14:39 -0400
[Message part 4 (text/plain, inline)]
Tags: patch


In rgrep, check matching files before excluding files

There are a lot of excluding globs, and checking them all is expensive.
The files glob (i.e. the glob for files we actually want) is usually
just one or two entries, so it's quite fast to check.

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.

When the files glob is "* .*", there's no benefit from this change,
since we still have to check every excluding glob anyway.  But there's
also no cost.

* lisp/progmodes/grep.el (rgrep-default-command): Move the
excluded files glob to part of the "files" argument.

In GNU Emacs 29.2.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw scroll bars) of 2024-05-20 built on
 igm-qws-u22796a
Repository revision: 734740051bd377d24899d08d00ec8e1bb8e00e00
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Rocky Linux 8.9 (Green Obsidian)

Configured using:
 'configure -C --with-x-toolkit=lucid --with-gif=ifavailable
 --with-native-compilation=aot'

[0001-In-rgrep-check-matching-files-before-excluding-files.patch (text/patch, attachment)]

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.