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

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

-i and --color makes grep runs very slow


From: Jeremy M. Dolan
Subject: -i and --color makes grep runs very slow
Date: Mon, 31 Dec 2001 02:36:07 -0600
User-agent: Mutt/1.2.5i

I love --color, previously I was using rgrep when I needed this
functionality. However, I've just noticed when used in combination
with -i, grep runs VERY slowly.

% ls -l index.html.1
-rw-r--r--    1 jmd      jmd         26372 Dec 31 02:19 index.html.1
% time grep -i embed index.html.1
[output...]
  0.00s user 0.01s system 87% cpu 0.011 total
% time grep -i --color embed index.html.1
[output...]
  10.87s user 0.06s system 88% cpu 12.345 total

Yep. One one-hundredth of a second jumped to 12.3 seconds. The lines
aren't particularly long either. Some are longer then 80, but they're
all under 200. Certainly not long enough that editing the string
should incur a 112,200% performance decrease.

With another text file, I don't see this:

% ls -l all-rh72-rpms
-rw-r--r--    1 jmd      jmd        103194 Dec 19 23:40 all-rh72-rpms
% time grep -i --color foo all-rh72-rpms
[output...]
  0.68s user 0.00s system 79% cpu 0.859 total

But with another HTML file, it's back:

% ls -l quotes.htm
-rw-r--r--    1 jmd      jmd         66257 Dec 13 15:03 quotes.htm
% time grep -i --color foo quotes.htm
[output...]
  15.46s user 0.08s system 87% cpu 17.736 total

I'm attaching the index.html.1 file I used in the first test. For what
it's worth, it's the HTML off of www.marvel.com.

-- 
Jeremy M. Dolan <mailto:address@hidden> <http://turbogeek.org/>
PGP: 1024D/DC433DEE 494C 7A6E 19FB 026A 1F52  E0D5 5C5D 6228 DC43 3DEE

Attachment: index.html.1.gz
Description: application/gunzip


reply via email to

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