[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
how is grep so fast?
From: |
Edward Peschko |
Subject: |
how is grep so fast? |
Date: |
Sun, 7 Jun 2009 11:15:49 -0700 |
All,
I was writing my own, 'grep-like' program, and while doing so, I noticed that
grep is exceedingly fast.
This simple loop on linux takes about 3 seconds, vs a whole grep run
which took 1.
while (fgets(buf, 32768, fp) { }
Adding pcre made my equivalent 'grep' command come out to about 8 seconds.
So how does grep manage to be so fast? I'm really curious about this; I'd like
to emulate this behavior if possible, or maybe use grep as an API if possible.
Thanks much,
Ed
- how is grep so fast?,
Edward Peschko <=