GNU bug report logs - #64735
29.0.92; find invocations are ~15x slower because of ignores

Previous Next

Package: emacs;

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

Date: Wed, 19 Jul 2023 21:17:02 UTC

Severity: normal

Found in version 29.0.92

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: dmitry <at> gutov.dev, 64735 <at> debbugs.gnu.org
Subject: bug#64735: 29.0.92; find invocations are ~15x slower because of ignores
Date: Tue, 02 Sep 2025 19:37:24 +0300
> Cc: 64735 <at> debbugs.gnu.org
> Date: Tue, 02 Sep 2025 12:23:10 -0400
> From:  Spencer Baugh via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> Dmitry Gutov <dmitry <at> gutov.dev> writes:
> 
> > On 20/07/2023 00:16, Spencer Baugh wrote:
> >> In Emacs alone, there are a few things we could do:
> >> - we could mitigate the find bug by optimizing the regexp before we pass
> >> it to find; this should basically remove all the overhead but makes the
> >> find command uglier and harder to edit
> >
> > I like these two approaches.
> 
> Much delayed, but the attached patch implements this optimization
> approach.  In my testing, it provides a substantial speed-up for rgrep.

Thanks.

> +(defcustom grep-find-optimize-matching t

I'd call this grep-find-use-find-regex, or somesuch.

> +This affects ignores from `grep-find-ignored-directories' and
> +`grep-find-ignored-files' and the globs passed as FILES to `rgrep'."
> +  :type 'boolean)

The :version tag is missing.

> +If `grep-find-optimize-matching' is non-nil and ARG is a known valid
> +find argument, then instead return a single \"-regex\" or \"-iregex\"
> +argument which matches all of GLOBS."
> +  (if-let* ((grep-find-optimize-matching)
> +            (known-arg (assoc arg '(("-path" "-regex" 'path)
> +                                    ("-name" "-regex" 'name)
> +                                    ("-ipath" "-iregex" 'path)
> +                                    ("-iname" "-iregex" 'name))))

Isn't the -regex/-iregex option a GNU extension?  If so, this should
only be used with GNU Find.

Also, do we need to use -regextype as well, to make sure the regexp we
produce is interpreted correctly?




This bug report was last modified 16 days ago.

Previous Next


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