Opened 16 years ago

Closed 16 years ago

#697 closed Support Requests (Fixed)

performance of boost::regex

Reported by: nobody Owned by: nobody
Milestone: Component: None
Version: None Severity:
Keywords: Cc:

Description

Is there any differenc between PERL and POSIX 
regarding the speed of the matching? does the flag 
match_posix affect it?

Does regex implement Knuth-Morris-Pratt or any other 
string matching algorithm? Is there such in boost at 
all?

Cheers, Doris.

Change History (1)

comment:1 by John Maddock, 16 years ago

Status: assignedclosed
Logged In: YES 
user_id=14804

Yes there is a difference between Perl and Posix style
matching: Boost.Regex is basically a Perl style matcher that
supports POSIX style matching as an optional extra.  So Perl
style matches are always faster in this implementation.

Boost.Regex did previously use the Knuth_Morris-Pratt
algorithm for regexes that have a string literal prefix. 
However, that code is currently disabled in the source. 
Believe it or not it's actually slower in practice than a
simple table-based scan.

HTH, John.
Note: See TracTickets for help on using tickets.