bug-gnu-utils
[Top][All Lists]
Advanced

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

[grep] about 200 times slower than Sed or Perl


From: Eduard Bloch
Subject: [grep] about 200 times slower than Sed or Perl
Date: Tue, 9 Mar 2004 11:44:47 +0100
User-agent: Mutt/1.5.5.1+cvs20040105i

Hello,

today I tried to weed out some useles lines from a large log file and
was amazed to see that the current grep versions (and fgrep) are
slow like hell.

debian:/# time fgrep -v MAC /var/log/kern.log  | tail
...
real    0m25.092s
user    0m24.902s
sys     0m0.006s
debian:/# time perl -pe 'undef $_ if /MAC/' < /var/log/kern.log  | tail
...
real    0m0.148s
user    0m0.065s
sys     0m0.007s

I don't think that this is a bug in POSIX regexp implementation, since
Sed is much faster (but still 7 times slower than Perl, lol):

debian:/# time sed -e 's/MAC/foobar/' < /var/log/kern.log  | tail
...
real    0m0.747s
user    0m0.719s
sys     0m0.016s
debian:/# time perl -pe 's/MAC/foobar/' < /var/log/kern.log  | tail
...
real    0m0.123s
user    0m0.090s
sys     0m0.016s

MfG,
Eduard.




reply via email to

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