FS#7141 - grep is extremely slow

Attached to Project: Arch Linux
Opened by Xavier (shining) - Saturday, 12 May 2007, 22:05 GMT
Last edited by Tobias Powalowski (tpowa) - Saturday, 08 December 2007, 11:42 GMT
Task Type Bug Report
Category Packages: Current
Status Closed
Assigned To Tobias Powalowski (tpowa)
Architecture All
Severity Medium
Priority Normal
Reported Version 0.8 Voodoo
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

It has been reported in several places, see for example debian report :
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=181378

From their changelog :
* Patched 64-egf-speedup.patch with patch from Nicolas François
<nicolas.francois@centraliens.net>. Put 64-egf-speedup.patch,
65-dfa-optional.patch, 66-match_icase.patch and 67-w.patch back

you can get debian patches from there :
http://ftp.debian.org/debian/pool/main/g/grep/grep_2.5.1.ds2-6.diff.gz
then just run somewhere :
zcat grep_2.5.1.ds2-6.diff.gz | patch -p1
and above patches will be available in debian/patch

or maybe rather directly from fedora cvs, since it looks like they come from there anyway :
http://cvs.fedora.redhat.com/viewcvs/devel/grep/

Apparently, these patches were also proposed to upstream.
See the four Red Hat's patch on this page:
http://savannah.gnu.org/patch/?group=grep
This task depends upon

Closed by  Tobias Powalowski (tpowa)
Saturday, 08 December 2007, 11:42 GMT
Reason for closing:  Fixed
Additional comments about closing:  in new grep package
Comment by Xavier (shining) - Saturday, 12 May 2007, 22:53 GMT
these 4 patches alone didn't apply cleanly.
So I tried all 15 patches in the order found in this file:
http://cvs.fedora.redhat.com/viewcvs/devel/grep/grep.spec?view=markup
and it fixed the problem.
Wouldn't all these other patches be of interest as well?
I mean, they were made for a reason, and they aren't specific to fedora.

At the minimum, for these 4 patches (number 3,10,11,13) to apply cleanly without editing,
I had to apply the first 3 as well.
So I applied patch numbers 0,1,2,3,10,11,13
Comment by Xavier (shining) - Saturday, 01 December 2007, 18:34 GMT
The patches have been dropped because they don't apply anymore with the new 2.5.3 version.
I am back on 286.77 sec with utf8 locale, compared to 0.10 sec otherwise. So close to 3000x slower.
Comment by Xavier (shining) - Saturday, 01 December 2007, 19:18 GMT
So, fedora patches are outdated, but not debian ones. I already mentioned in the original report debian patches were also a possibility.
It's just that this diff.gz is less practical to work with.
http://ftp.debian.org/debian/pool/main/g/grep/grep_2.5.3~dfsg-3.diff.gz

And there is actually only one patch needed from that diff.gz to totally fix the performance issue :
64-egf-speedup.patch

It's similar to the 09-egf-speedup.patch from fedora cvs, except that it applies cleanly.
Or nearly, for some very weird reason, that patch has a buggy 107th line which needs to be removed :
#@@ -303,47 +282,78 @@ hunk6

The only grep debian patch we need is the only one to have this problem...
Attaching the patch without the buggy line.
Comment by Xavier (shining) - Saturday, 01 December 2007, 19:19 GMT
Actually attach the fixed patch this time.
Comment by Xavier (shining) - Sunday, 02 December 2007, 07:40 GMT
The patches have been dropped because they don't apply anymore with the new 2.5.3 version.
I am back on 286.77 sec with utf8 locale, compared to 0.10 sec otherwise. So close to 3000x slower.

Loading...