GNU bug report logs - #43527
[PATCH] grep: avoid unneeded compilation of regex

Previous Next

Package: grep;

Reported by: Norihiro Tanaka <noritnk <at> kcn.ne.jp>

Date: Sun, 20 Sep 2020 07:17:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 43527 in the body.
You can then email your comments to 43527 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#43527; Package grep. (Sun, 20 Sep 2020 07:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Norihiro Tanaka <noritnk <at> kcn.ne.jp>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Sun, 20 Sep 2020 07:17:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
To: <bug-grep <at> gnu.org>
Subject: [PATCH] grep: avoid unneeded compilation of regex
Date: Sun, 20 Sep 2020 16:16:43 +0900
[Message part 1 (text/plain, inline)]
Hi,

Performace for as following case is fixed in bug#43040.

  $ yes 0 | head -100000 | sed '$s/././' >pat
  $ grep -vf pat /dev/null

However, still slow and a lot of memory wasted for the following cases.

  $ grep -vf /usr/share/dict/linux.words /usr/share/dict/linux.words

This bug is introduced in commit abb7f4f2325f26f930ff59b702fe42568a8e81e7.
Though it's an optimization for patterns with backreferences, it seems
to cause performance degradation in many cases due to regex
implementation issues.

grep needs regex engine when patterns is not supported by DFA engine,
and when either given only matching (-o) or color option (--color) is
given.

In other words, if none of them are met, grep only uses regex to check
the syntax.  grep avoids compilation of regex not to check syntax by this
patch.
[0001-grep-avoid-unneeded-compilation-of-regex.patch (text/plain, attachment)]
[0001-dfa-change-dfasupported-to-global-function.patch (text/plain, attachment)]

Information forwarded to bug-grep <at> gnu.org:
bug#43527; Package grep. (Mon, 21 Sep 2020 01:35:01 GMT) Full text and rfc822 format available.

Message #8 received at 43527 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
Cc: 43527 <at> debbugs.gnu.org
Subject: Re: bug#43527: [PATCH] grep: avoid unneeded compilation of regex
Date: Sun, 20 Sep 2020 18:34:02 -0700
On Sun, Sep 20, 2020 at 12:17 AM Norihiro Tanaka <noritnk <at> kcn.ne.jp> wrote:
> Hi,
> Performace for as following case is fixed in bug#43040.
>
>   $ yes 0 | head -100000 | sed '$s/././' >pat
>   $ grep -vf pat /dev/null
>
> However, still slow and a lot of memory wasted for the following cases.
>
>   $ grep -vf /usr/share/dict/linux.words /usr/share/dict/linux.words
>
> This bug is introduced in commit abb7f4f2325f26f930ff59b702fe42568a8e81e7.
> Though it's an optimization for patterns with backreferences, it seems
> to cause performance degradation in many cases due to regex
> implementation issues.
>
> grep needs regex engine when patterns is not supported by DFA engine,
> and when either given only matching (-o) or color option (--color) is
> given.
>
> In other words, if none of them are met, grep only uses regex to check
> the syntax.  grep avoids compilation of regex not to check syntax by this
> patch.

Yikes. Thank you!
That exposes (and fixes in this common case) a problem that makes grep
require memory that is quadratic in the number of regular expressions.

To illustrate, I ran some timings.
With only 80,000 lines of /usr/share/dict/linux.words, the following
would use 100GB of RSS and take 3 minutes. With the fix, it used less
than 400MB and took less than one second.

  head -$N /usr/share/dict/linux.words > w; grep -vf w w

N            Mem(k): Old         New
20000     6341188 (2.4s)    103168
40000    25241288 (9.29s)   199188 (0.31s)
80000   100547432 (180s)    392872 (0.66s)

I've just pushed the gnulib-adjusting patch and will push the other soon.
I'll also add a test and a NEWS item in a separate patch.




Information forwarded to bug-grep <at> gnu.org:
bug#43527; Package grep. (Tue, 22 Sep 2020 00:34:02 GMT) Full text and rfc822 format available.

Message #11 received at 43527 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
Cc: 43527 <at> debbugs.gnu.org
Subject: Re: bug#43527: [PATCH] grep: avoid unneeded compilation of regex
Date: Mon, 21 Sep 2020 17:33:25 -0700
[Message part 1 (text/plain, inline)]
On Sun, Sep 20, 2020 at 6:34 PM Jim Meyering <jim <at> meyering.net> wrote:
>
> On Sun, Sep 20, 2020 at 12:17 AM Norihiro Tanaka <noritnk <at> kcn.ne.jp> wrote:
> > Hi,
> > Performace for as following case is fixed in bug#43040.
> >
> >   $ yes 0 | head -100000 | sed '$s/././' >pat
> >   $ grep -vf pat /dev/null
> >
> > However, still slow and a lot of memory wasted for the following cases.
> >
> >   $ grep -vf /usr/share/dict/linux.words /usr/share/dict/linux.words
> >
> > This bug is introduced in commit abb7f4f2325f26f930ff59b702fe42568a8e81e7.
> > Though it's an optimization for patterns with backreferences, it seems
> > to cause performance degradation in many cases due to regex
> > implementation issues.
> >
> > grep needs regex engine when patterns is not supported by DFA engine,
> > and when either given only matching (-o) or color option (--color) is
> > given.
> >
> > In other words, if none of them are met, grep only uses regex to check
> > the syntax.  grep avoids compilation of regex not to check syntax by this
> > patch.
>
> Yikes. Thank you!
> That exposes (and fixes in this common case) a problem that makes grep
> require memory that is quadratic in the number of regular expressions.
>
> To illustrate, I ran some timings.
> With only 80,000 lines of /usr/share/dict/linux.words, the following
> would use 100GB of RSS and take 3 minutes. With the fix, it used less
> than 400MB and took less than one second.
>
>   head -$N /usr/share/dict/linux.words > w; grep -vf w w
>
> N            Mem(k): Old         New
> 20000     6341188 (2.4s)    103168
> 40000    25241288 (9.29s)   199188 (0.31s)
> 80000   100547432 (180s)    392872 (0.66s)
>
> I've just pushed the gnulib-adjusting patch and will push the other soon.
> I'll also add a test and a NEWS item in a separate patch.

Here are the two patches (tested on top of a third that updates to
latest gnulib). I'll await an 'ok' from Norihiro Tanaka before
pushing, since commit-log metadata is essentially immutable once
pushed.
[0002-tests-test-for-many-regexp-N-2-RSS-regression.patch (application/octet-stream, attachment)]
[0001-grep-avoid-unnecessary-regex-compilation.patch (application/octet-stream, attachment)]

Information forwarded to bug-grep <at> gnu.org:
bug#43527; Package grep. (Tue, 22 Sep 2020 14:55:01 GMT) Full text and rfc822 format available.

Message #14 received at 43527 <at> debbugs.gnu.org (full text, mbox):

From: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
To: Jim Meyering <jim <at> meyering.net>
Cc: 43527 <at> debbugs.gnu.org
Subject: Re: bug#43527: [PATCH] grep: avoid unneeded compilation of regex
Date: Tue, 22 Sep 2020 23:54:10 +0900
On Mon, 21 Sep 2020 17:33:25 -0700
Jim Meyering <jim <at> meyering.net> wrote:

> On Sun, Sep 20, 2020 at 6:34 PM Jim Meyering <jim <at> meyering.net> wrote:
> >
> > On Sun, Sep 20, 2020 at 12:17 AM Norihiro Tanaka <noritnk <at> kcn.ne.jp> wrote:
> > > Hi,
> > > Performace for as following case is fixed in bug#43040.
> > >
> > >   $ yes 0 | head -100000 | sed '$s/././' >pat
> > >   $ grep -vf pat /dev/null
> > >
> > > However, still slow and a lot of memory wasted for the following cases.
> > >
> > >   $ grep -vf /usr/share/dict/linux.words /usr/share/dict/linux.words
> > >
> > > This bug is introduced in commit abb7f4f2325f26f930ff59b702fe42568a8e81e7.
> > > Though it's an optimization for patterns with backreferences, it seems
> > > to cause performance degradation in many cases due to regex
> > > implementation issues.
> > >
> > > grep needs regex engine when patterns is not supported by DFA engine,
> > > and when either given only matching (-o) or color option (--color) is
> > > given.
> > >
> > > In other words, if none of them are met, grep only uses regex to check
> > > the syntax.  grep avoids compilation of regex not to check syntax by this
> > > patch.
> >
> > Yikes. Thank you!
> > That exposes (and fixes in this common case) a problem that makes grep
> > require memory that is quadratic in the number of regular expressions.
> >
> > To illustrate, I ran some timings.
> > With only 80,000 lines of /usr/share/dict/linux.words, the following
> > would use 100GB of RSS and take 3 minutes. With the fix, it used less
> > than 400MB and took less than one second.
> >
> >   head -$N /usr/share/dict/linux.words > w; grep -vf w w
> >
> > N            Mem(k): Old         New
> > 20000     6341188 (2.4s)    103168
> > 40000    25241288 (9.29s)   199188 (0.31s)
> > 80000   100547432 (180s)    392872 (0.66s)
> >
> > I've just pushed the gnulib-adjusting patch and will push the other soon.
> > I'll also add a test and a NEWS item in a separate patch.
> 
> Here are the two patches (tested on top of a third that updates to
> latest gnulib). I'll await an 'ok' from Norihiro Tanaka before
> pushing, since commit-log metadata is essentially immutable once
> pushed.

Great, thank you.  I confirmed it.





Information forwarded to bug-grep <at> gnu.org:
bug#43527; Package grep. (Tue, 22 Sep 2020 15:51:02 GMT) Full text and rfc822 format available.

Message #17 received at 43527 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
Cc: 43527 <at> debbugs.gnu.org
Subject: Re: bug#43527: [PATCH] grep: avoid unneeded compilation of regex
Date: Tue, 22 Sep 2020 08:50:03 -0700
On Tue, Sep 22, 2020 at 7:54 AM Norihiro Tanaka <noritnk <at> kcn.ne.jp> wrote:
> On Mon, 21 Sep 2020 17:33:25 -0700
> Jim Meyering <jim <at> meyering.net> wrote:
...
> > Here are the two patches (tested on top of a third that updates to
> > latest gnulib). I'll await an 'ok' from Norihiro Tanaka before
> > pushing, since commit-log metadata is essentially immutable once
> > pushed.
>
> Great, thank you.  I confirmed it.

Thanks. Pushed.




bug closed, send any further explanations to 43527 <at> debbugs.gnu.org and Norihiro Tanaka <noritnk <at> kcn.ne.jp> Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Tue, 22 Sep 2020 17:21:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-grep <at> gnu.org:
bug#43527; Package grep. (Tue, 22 Sep 2020 22:58:01 GMT) Full text and rfc822 format available.

Message #22 received at 43527 <at> debbugs.gnu.org (full text, mbox):

From: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
To: Jim Meyering <jim <at> meyering.net>
Cc: 43527 <at> debbugs.gnu.org
Subject: Re: bug#43527: [PATCH] grep: avoid unneeded compilation of regex
Date: Wed, 23 Sep 2020 07:57:30 +0900
[Message part 1 (text/plain, inline)]
On Tue, 22 Sep 2020 08:50:03 -0700
Jim Meyering <jim <at> meyering.net> wrote:

> On Tue, Sep 22, 2020 at 7:54 AM Norihiro Tanaka <noritnk <at> kcn.ne.jp> wrote:
> > On Mon, 21 Sep 2020 17:33:25 -0700
> > Jim Meyering <jim <at> meyering.net> wrote:
> ...
> > > Here are the two patches (tested on top of a third that updates to
> > > latest gnulib). I'll await an 'ok' from Norihiro Tanaka before
> > > pushing, since commit-log metadata is essentially immutable once
> > > pushed.
> >
> > Great, thank you.  I confirmed it.
> 
> Thanks. Pushed.

Oh, I found a bug for this fix.  If Fexecute is called first without
start_ptr and next with start_ptr, it may break.
[0001-grep-fix-a-bug-in-the-previous-commit.patch (text/plain, attachment)]

Information forwarded to bug-grep <at> gnu.org:
bug#43527; Package grep. (Tue, 22 Sep 2020 23:26:01 GMT) Full text and rfc822 format available.

Message #25 received at 43527 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
Cc: 43527 <at> debbugs.gnu.org
Subject: Re: bug#43527: [PATCH] grep: avoid unneeded compilation of regex
Date: Tue, 22 Sep 2020 16:25:06 -0700
On Tue, Sep 22, 2020 at 3:57 PM Norihiro Tanaka <noritnk <at> kcn.ne.jp> wrote:
> On Tue, 22 Sep 2020 08:50:03 -0700
> Jim Meyering <jim <at> meyering.net> wrote:
>
> > On Tue, Sep 22, 2020 at 7:54 AM Norihiro Tanaka <noritnk <at> kcn.ne.jp> wrote:
> > > On Mon, 21 Sep 2020 17:33:25 -0700
> > > Jim Meyering <jim <at> meyering.net> wrote:
> > ...
> > > > Here are the two patches (tested on top of a third that updates to
> > > > latest gnulib). I'll await an 'ok' from Norihiro Tanaka before
> > > > pushing, since commit-log metadata is essentially immutable once
> > > > pushed.
> > >
> > > Great, thank you.  I confirmed it.
> >
> > Thanks. Pushed.
>
> Oh, I found a bug for this fix.  If Fexecute is called first without
> start_ptr and next with start_ptr, it may break.

Oh! Good timing. I was about to make a new snapshot.
Do you happen to have a test case handy that demonstrates the failure?




Information forwarded to bug-grep <at> gnu.org:
bug#43527; Package grep. (Wed, 23 Sep 2020 03:05:02 GMT) Full text and rfc822 format available.

Message #28 received at 43527 <at> debbugs.gnu.org (full text, mbox):

From: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
To: Jim Meyering <jim <at> meyering.net>
Cc: 43527 <at> debbugs.gnu.org
Subject: Re: bug#43527: [PATCH] grep: avoid unneeded compilation of regex
Date: Wed, 23 Sep 2020 12:04:26 +0900
[Message part 1 (text/plain, inline)]
On Tue, 22 Sep 2020 16:25:06 -0700
Jim Meyering <jim <at> meyering.net> wrote:

> Oh! Good timing. I was about to make a new snapshot.
> Do you happen to have a test case handy that demonstrates the failure?

I added test case to previous patch.

By the way, I found the following bug in making the test case, and it's
still left.

$ env LC_ALL=tr_TR.utf8 grep -Fio i in
Aborted (core dumped)

(gdb) bt
#0  0x0000003b8d032495 in raise () from /lib64/libc.so.6
#1  0x0000003b8d033c75 in abort () from /lib64/libc.so.6
#2  0x000000000040cdde in kwsinit (mb_trans=true) at searchutils.c:64
#3  0x0000000000409624 in Fcompile (pattern=0x23c1240 "i\n", size=1, ignored=0, exact=true) at kwsearch.c:56
#4  0x0000000000409378 in main (argc=4, argv=0x7ffe76048388) at grep.c:2977
[0001-grep-fix-a-bug-in-the-previous-commit.patch (text/plain, attachment)]

Information forwarded to bug-grep <at> gnu.org:
bug#43527; Package grep. (Thu, 24 Sep 2020 03:01:01 GMT) Full text and rfc822 format available.

Message #31 received at 43527 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
Cc: 43527 <at> debbugs.gnu.org
Subject: Re: bug#43527: [PATCH] grep: avoid unneeded compilation of regex
Date: Wed, 23 Sep 2020 20:00:11 -0700
On Tue, Sep 22, 2020 at 8:04 PM Norihiro Tanaka <noritnk <at> kcn.ne.jp> wrote:
> On Tue, 22 Sep 2020 16:25:06 -0700
> Jim Meyering <jim <at> meyering.net> wrote:
>
> > Oh! Good timing. I was about to make a new snapshot.
> > Do you happen to have a test case handy that demonstrates the failure?
>
> I added test case to previous patch.

Thank you, I expect to push it shortly, along with a gnulib-sync diff,
to pull in Paul's regex fixes.

> By the way, I found the following bug in making the test case, and it's
> still left.
>
> $ env LC_ALL=tr_TR.utf8 grep -Fio i in
> Aborted (core dumped)
>
> (gdb) bt
> #0  0x0000003b8d032495 in raise () from /lib64/libc.so.6
> #1  0x0000003b8d033c75 in abort () from /lib64/libc.so.6
> #2  0x000000000040cdde in kwsinit (mb_trans=true) at searchutils.c:64
> #3  0x0000000000409624 in Fcompile (pattern=0x23c1240 "i\n", size=1, ignored=0, exact=true) at kwsearch.c:56
> #4  0x0000000000409378 in main (argc=4, argv=0x7ffe76048388) at grep.c:2977

Please tell us what is in your input file named "in" and what type of
system you're using.
If I guess it's the "in" file from the turkish-eyes test, and try the
following (using both your and Paul's patches), I see no failure:

$ i=$(printf '\304\261') I=$(printf '\304\260'); data="I:$I $i:i";
echo "$data" > in; env LC_ALL=tr_TR.utf8 src/grep -Fio i in
İ
i




Information forwarded to bug-grep <at> gnu.org:
bug#43527; Package grep. (Thu, 24 Sep 2020 03:17:02 GMT) Full text and rfc822 format available.

Message #34 received at 43527 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jim Meyering <jim <at> meyering.net>
Cc: Norihiro Tanaka <noritnk <at> kcn.ne.jp>, 43527 <at> debbugs.gnu.org
Subject: Re: bug#43527: [PATCH] grep: avoid unneeded compilation of regex
Date: Wed, 23 Sep 2020 20:16:47 -0700
On 9/23/20 8:00 PM, Jim Meyering wrote:

> Thank you, I expect to push it shortly, along with a gnulib-sync diff,
> to pull in Paul's regex fixes.

Ouch, it looks like we had dueling commits prepared, as I read your email just 
after pushing a more-extensive patch.

I looked at Norihiro's recent "grep: fix a bug in the previous commit" patch 
<https://bugs.gnu.org/43527#28>. Although the test case added by that patch 
exposed a bug in Savannah grep before I installed the "grep: fix more 
Turkish-eyes bugs" patch just now, that test case works with current grep master 
on Savannah (commit 8577dda638ebfee2b77342a4d07252745ec42a3a). This isn't 
surprising, as the "grep: fix more Turkish-eyes bugs" patch tests the same thing 
plus some more stuff.

It'd be good to have a different test case to demonstrate why the "grep: fix a 
bug in the previous commit" patch is needed to kwsearch.c. I'll take a look at that.




Information forwarded to bug-grep <at> gnu.org:
bug#43527; Package grep. (Thu, 24 Sep 2020 03:42:02 GMT) Full text and rfc822 format available.

Message #37 received at 43527 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Norihiro Tanaka <noritnk <at> kcn.ne.jp>, 43527 <at> debbugs.gnu.org
Subject: Re: bug#43527: [PATCH] grep: avoid unneeded compilation of regex
Date: Wed, 23 Sep 2020 20:41:40 -0700
On Wed, Sep 23, 2020 at 8:16 PM Paul Eggert <eggert <at> cs.ucla.edu> wrote:
> On 9/23/20 8:00 PM, Jim Meyering wrote:
> > Thank you, I expect to push it shortly, along with a gnulib-sync diff,
> > to pull in Paul's regex fixes.
>
> Ouch, it looks like we had dueling commits prepared, as I read your email just
> after pushing a more-extensive patch.

I noticed, but it wasn't a problem.
Thanks for all the work (from both you and Norihiro) that went into
those changes.

> I looked at Norihiro's recent "grep: fix a bug in the previous commit" patch
> <https://bugs.gnu.org/43527#28>. Although the test case added by that patch
> exposed a bug in Savannah grep before I installed the "grep: fix more
> Turkish-eyes bugs" patch just now, that test case works with current grep master
> on Savannah (commit 8577dda638ebfee2b77342a4d07252745ec42a3a). This isn't
> surprising, as the "grep: fix more Turkish-eyes bugs" patch tests the same thing
> plus some more stuff.
>
> It'd be good to have a different test case to demonstrate why the "grep: fix a
> bug in the previous commit" patch is needed to kwsearch.c. I'll take a look at that.

I agree. Hoping to make the next snapshot soon, but not before
tomorrow (Thu) evening.




Information forwarded to bug-grep <at> gnu.org:
bug#43527; Package grep. (Sat, 26 Sep 2020 20:49:02 GMT) Full text and rfc822 format available.

Message #40 received at 43527-done <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
Cc: 43527-done <at> debbugs.gnu.org
Subject: Re: bug#43527: [PATCH] grep: avoid unneeded compilation of regex
Date: Sat, 26 Sep 2020 13:48:16 -0700
On Tue, Sep 22, 2020 at 8:04 PM Norihiro Tanaka <noritnk <at> kcn.ne.jp> wrote:
> On Tue, 22 Sep 2020 16:25:06 -0700
> Jim Meyering <jim <at> meyering.net> wrote:
>
> > Oh! Good timing. I was about to make a new snapshot.
> > Do you happen to have a test case handy that demonstrates the failure?
>
> I added test case to previous patch.
>
> By the way, I found the following bug in making the test case, and it's
> still left.
>
> $ env LC_ALL=tr_TR.utf8 grep -Fio i in
> Aborted (core dumped)
>
> (gdb) bt
> #0  0x0000003b8d032495 in raise () from /lib64/libc.so.6
> #1  0x0000003b8d033c75 in abort () from /lib64/libc.so.6
> #2  0x000000000040cdde in kwsinit (mb_trans=true) at searchutils.c:64
> #3  0x0000000000409624 in Fcompile (pattern=0x23c1240 "i\n", size=1, ignored=0, exact=true) at kwsearch.c:56
> #4  0x0000000000409378 in main (argc=4, argv=0x7ffe76048388) at grep.c:2977

Using the latest sources plus that patch, I ran all of the tests with
an assertion that kwsearch->exact == !!start_ptr before each use of
that new member, and the assertion never failed.
As far as I can see, this patch is not necessary (also, I could not
reproduce your abort), so I'm closing this issue. Please reopen if you
can demonstrate its utility.




Information forwarded to bug-grep <at> gnu.org:
bug#43527; Package grep. (Sun, 27 Sep 2020 01:13:01 GMT) Full text and rfc822 format available.

Message #43 received at 43527-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jim Meyering <jim <at> meyering.net>, Norihiro Tanaka <noritnk <at> kcn.ne.jp>
Cc: 43527-done <at> debbugs.gnu.org
Subject: Re: bug#43527: [PATCH] grep: avoid unneeded compilation of regex
Date: Sat, 26 Sep 2020 18:12:37 -0700
On 9/26/20 1:48 PM, Jim Meyering wrote:
> As far as I can see, this patch is not necessary (also, I could not
> reproduce your abort), so I'm closing this issue. Please reopen if you
> can demonstrate its utility.

When I looked into it last week, I did the same thing with an assert with the 
same results that you got.

In looking at the source code I thought that the patch wasn't needed for current 
'grep' and so could wait until after the release. The patch should be harmless 
(though this fact isn't trivial) and I can see it being useful for plausible 
future performance improvements, so it would make sense to install it after the 
next release.




Information forwarded to bug-grep <at> gnu.org:
bug#43527; Package grep. (Sun, 27 Sep 2020 02:20:02 GMT) Full text and rfc822 format available.

Message #46 received at 43527-done <at> debbugs.gnu.org (full text, mbox):

From: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Jim Meyering <jim <at> meyering.net>, 43527-done <at> debbugs.gnu.org
Subject: Re: bug#43527: [PATCH] grep: avoid unneeded compilation of regex
Date: Sun, 27 Sep 2020 11:19:08 +0900
On Sat, 26 Sep 2020 18:12:37 -0700
Paul Eggert <eggert <at> cs.ucla.edu> wrote:

> The patch should be harmless (though this fact isn't trivial) and I can
> see it being useful for plausible future performance improvements, so it
> would make sense to install it after the next release.

No longer need the patch.

This bug occurs when the last argument of the first GEAcompile () is
executed with 'false' and regex search is requested for the compiled
pattern.

However, with a recent fix by Paul, the first GEAcompile() no longer
seems to run in any case.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 25 Oct 2020 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 155 days ago.

Previous Next


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