buggrep - 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

Tue 26 Mar 2013 07:46:55 AM UTC, original submission:  

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.

Jaroslav Škarvada <yarda>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by yarda (Submitted the item)
  •  

    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

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code