Replacing GNU grep revisited

Sean Farley sean-freebsd at farley.org
Wed Jun 25 11:53:02 PDT 2003


On Wed, 25 Jun 2003, Christopher Weimann wrote:

> There is at least one aspect of freegrep that doesn't even come
> close to GNU grep, fgrep.

I just added fgrep handling.  It better be slower. :)  At least it will
now try a faster method on the patterns before hitting the regex
library.  It is still slow.

> I ran both of these more than once so it is not a fluke.  After
> looking at it further it seems that freegrep does not use the
> Aho-Corasick algorithim for fgrep but just uses brute force.

Yes, it uses brute force.  I am considering either Aho-Corasick,
Commentz-Walter (used in GNU fgrep) or the Boyer-Moore variation used in
Glimpse and an older agrep.  The last algorithm is supposedly the
fastest, but I do not know if these algorithms are patent-free or not.

> I wonder how many of the other old utils outrun our modern ones.
> I guess it must be all those gotos. :)

Better than a lot of gosubs.  :)

Sean
-----------------------
sean-freebsd at farley.org


More information about the freebsd-hackers mailing list