Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2008-04-16 04:45:07


Sam Jiang wrote:
> Hi All
>
> I'm just wondering; what kind of optimizations does the regex library
> come with?
> i.e if I was to say ^(string1|string2|string3), does it result in same
> performance as using ^string[123]?

No not currently - actually I don't know of any Perl-Regex libraries that do
that at present (but may well be wrong).

Most of the optimisations relate to:

* Skipping over text that can't possibly match in a small tight loop when
searching large texts.
* Pruning the search tree as aggressively as possible, to avoid the Perl
Regex O(N!) worst case behaviour where possible.

HTH, John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk