[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep 2.5.4 very slow with fixed pattern

From: Ethan Grammatikidis
Subject: grep 2.5.4 very slow with fixed pattern
Date: Thu, 11 Jun 2009 20:19:49 +0100

Hi, I just found grep being several orders of magnitude slower than Gnu sed for 
doing the same task. I ran some timings, perhaps best if I just paste the 
results. Grep is GNU grep 2.5.4, sed is GNU sed version 4.2, awk is GNU Awk 
3.1.6. "9 grep" is plan9port grep, included for comparison.

 $ wc -l deep-file-list
470485 deep-file-list
 $ 9 grep ethan deep-file-list |wc -l
 $ time grep ethan deep-file-list > /dev/null

real    4m29.491s
user    4m29.366s
sys     0m0.080s
 $ time grep -F ethan deep-file-list > /dev/null

real    4m27.740s
user    4m27.576s
sys     0m0.070s
 $ time awk '/ethan/ {print}' deep-file-list > /dev/null

real    0m2.597s
user    0m2.570s
sys     0m0.017s
 $ time sed -n /ethan/p deep-file-list > /dev/null

real    0m0.294s
user    0m0.273s
sys     0m0.020s
 $ time 9 grep ethan deep-file-list > /dev/null

real    0m0.155s
user    0m0.140s
sys     0m0.017s

Ethan Grammatikidis
The lyf so short, the craft so long to lerne. -- Chaucer

reply via email to

[Prev in Thread] Current Thread [Next in Thread]