[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how is grep so fast?
From: |
Dag Hovland |
Subject: |
Re: how is grep so fast? |
Date: |
Mon, 08 Jun 2009 09:33:35 +0200 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090320) |
Hi!
Edward Peschko wrote:
>
> This simple loop on linux takes about 3 seconds, vs a whole grep run
> which took 1.
>
> while (fgets(buf, 32768, fp) { }
>
This seems strange indeed. I can only reproduce similar behaviour when
searching a large binary file; in the matching cases, where the whole
file is not read by grep, it is of course fast. But in other cases this
should not happen. What exactly was the "whole grep run"?
Dag
smime.p7s
Description: S/MIME Cryptographic Signature