Ticket #697 (closed Support Requests: Fixed)

Opened 11 years ago

Last modified 11 years ago

performance of boost::regex

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


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 

Cheers, Doris.


Change History

comment:1 Changed 11 years ago by johnmaddock

  • Status changed from assigned to closed
Logged In: YES 

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.

Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.