Boost logo

Boost :

Subject: Re: [boost] [Xpressive] vs libpcre performance
From: David Abrahams (dave_at_[hidden])
Date: 2008-09-14 05:26:57


on Sun Sep 14 2008, Sebastian Redl <sebastian.redl-AT-getdesigned.at> wrote:

> Eric Niebler wrote:
>> Sebastian Redl wrote:
>> <snip>
>>
>>>
> http://www.linux-magazin.de/static/listings/magazin/2008/10/leser/cpp/footnotes.cpp>
>> <snip>
>>
>>> So to test the performance I took the existing submission and replaced
>>> libpcre with Xpressive (see attached file). I believe the solutions to be
>>> functionally equivalent. However, the original takes 6 seconds to process a
>>> 55MB file, whereas my variation takes ~15 seconds. That's on the second run
>>> of each program, meaning that the entire file is in the OS cache. This seems
>>> awfully slow.
>>
>> It does seem slow, especially considering all the IO, lexical casting and
>> memory management it's doing, besides the regexing. (I notice that the pcre
>> version isn't doing any lexical casting, but I can't tell if it's doing
>> something equivalent.)
> It is, by passing a pointer to an int to the matcher functions. libpcre converts
> internally.
>>
>> Are you sure you compiled with full optimizations turned on, and NDEBUG
>> defined?
> I use bjam's release mode.
> "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -fPIC
> -march=athlon64 -DNDEBUG
> The other program is compiled with
> g++ -O2

You should really try them with identical options, as -O3 is known to be
worse than -O2 in some cases.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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