What to learn from the BSD grep case [Was: why GNU grep is fast]
C. P. Ghost
cpghost at cordula.ws
Tue Aug 24 01:16:10 UTC 2010
On Mon, Aug 23, 2010 at 5:04 PM, Gabor Kovesdan <gabor at freebsd.org> wrote:
> 4, We really need a good regex library. From the comments, it seems there's
> no such in the open source world. GNU libregex isn't efficient because GNU
> grep uses those workarounds that Mike kindly pointed out. Oniguruma was
> extremely slow when I checked it. PCRE supports Perl-style syntax with a
> POSIX-like API but not POSIX regex. Google RE2 is the same with additional
> egrep syntax but doesn't have support for standard POSIX regexes. Plan 9
> regex only supports egrep syntax. It seems that TRE is the best choice. It
> is BSD-licensed, supports wchar and POSIX(ish) regexes and it is quite fast.
I know it's C++ and not exactly what you're needing, but have you evaluated
Boost::Regex? Isn't there some code that can be retrofitted into a C lib?
> I don't know the theoretical background of regex engines but I'm wondering
> if it's possible top provide an alternative API with byte-counted buffers
> and use the heuristical speedup with fixed string matching. As Mike pointed
> out the POSIX API is quite limiting because it works on NUL-terminated
> strings and not on byte-counted buffers, so we couldn't just do it with a
> POSIX-conformant library but it would be nice if we could implement it in
> such a library with an alternative interface.
Cordula's Web. http://www.cordula.ws/
More information about the freebsd-current