grep - Bugs: bug #38594, Poor grep performance for long...
You are not allowed to post comments on this tracker with your current authentication level.
bug #38594: Poor grep performance for long regexp compared to performance with -P option
Submitter: | Jaroslav Škarvada <yarda> | ||
Submitted: | Tue 26 Mar 2013 07:46:55 AM UTC | ||
Category: | None | Severity: | 3 - Normal |
Item Group: | None | Status: | None |
Privacy: | Public | Assigned to: | None |
Open/Closed: | Open |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
Carbon-Copy List
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
No changes have been made to this item
Powered by Savane 3.13-f8d8.
Corresponding source code
This was originally reported in:
http://bugzilla.redhat.com/show_bug.cgi?id=875131
There's huge gap between performance of grep and grep -P for certain regular expressions.
Steps to Reproduce:
1.
PATTERN="^....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 00000000000"
INPUTLINE=".................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. 00000000000"
for i in `seq -w 1 10000`; do echo ${i}${INPUTLINE}${i} >> /tmp/input ;done
2. time grep -P -v "$PATTERN" /tmp/input
3. time grep -v "$PATTERN" /tmp/input
4. time grep -v "^.\{1143\} 0\{11\}" /tmp/input
5. time grep -P -v "^.{1143} 0{11}" /tmp/input
4. export LANG=C
5. repeat 2., 3.
6. export LANG=en_US.iso88591
7. repeat 2., 3.
Actual results:
grep -P is 300-7000x faster than without -P option (for all combinations of LANG and usage of $PATTERN or "^.\{1143\} 0\{11\}", resp. "^.{1143} 0{11}" with -P).
Expected results:
performance of grep is comparable when using the same pattern.