Subject: bug#40634: closed (Re: bug#40634: Massive pattern list handling with -E format seems very slow since 2.28.)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 21 Sep 2020 19:23:02 +0000

Your bug report

#40634: Massive pattern list handling with -E format seems very slow since 2.28.

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

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
40634: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=40634
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#40634: Massive pattern list handling with -E format seems very slow since 2.28.
From: Paul Eggert <[email-masked]>
To: Jim Meyering <[email-masked]>
Cc: [email-masked], Gnulib bugs <[email-masked]>, [email-masked], Norihiro Tanaka <[email-masked]>, GNU grep developers <[email-masked]>
Date: Mon, 21 Sep 2020 12:22:50 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

The dust seems to have settled on this, so I'm closing the grep bug report to 
tidy things up.

Subject: Massive pattern list handling with -E format seems very slow since 2.28.
From: [email-masked]
To: "[email-masked]" <[email-masked]>
Date: Wed, 15 Apr 2020 09:26:55 +0900 (JST)
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

Massive pattern list handling with -E format seems very
slow, since grep 2.28.

Conversion from -E format to -F format may have problem
about performance.

When the processing time is measured by the script below,
the result isobviously different between 2.28 and 2.27.

----
#!/bin/bash
export LC_ALL=C

rm -f grep-patterns.txt
for i in {1..2000}; do
     pat=$(echo -n "$i" | sha1sum | cut -f1 -d ' ')
     echo -e "$pat$pat(\$|$pat)" >> grep-patterns.txt
done

echo executing grep...
time grep -E -v -m1 -f grep-patterns.txt /dev/null
----

The following is the results in my PC with fedora's RPM.
https://koji.fedoraproject.org/koji/packageinfo?packageID=1023

- result with grep 2.28

  real 0m11.087s / user 0m11.027s / sys 0m0.037s

- result with grep 2.27

  real 0m0.144s / user 0m0.116s / sys 0m0.027s

With also recent 3.4, result is same.

I hope you find it useful.

regards,