Regex performance improvements
Paolo Bonzini
bonzini@pc-amo3.elet.polimi.it
Thu May 17 01:37:00 GMT 2001
WRT the code to remove gapped support. It is still present by default,
but if you #define SINGLE_STRING it is removed; so glibc can still export
it, but clients which supply a version of GNU regex for compatibility can
#define it and compile a faster version. As I said, I did this for GNU
grep -- it is not harmful nor backwards-incompatible.
I also thought of adding a fixed-string optimization, which anchors
abc.*def to the last occurrence of def in the pattern; this could be done
with a fast Boyer-Moore search in single-byte mode, while in multi-byte
one could still use Boyer-Moore and encode the skip table in some cunning
way, or maybe employ Knuth-Morris-Pratt. This optimization is done in
Ruby's adaptation of regex.
--
|_ _ _ ___
|_)(_)| ) ,'
--------- '-._.
More information about the Libc-alpha
mailing list