Boost logo

Boost :

Subject: Re: [boost] [Xpressive] vs libpcre performance
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2008-09-14 04:43:56


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
>
>> Has anyone done a proper performance comparison between Xpressive and
>> libpcre?
>
> Not really, no. I may look into this, if it doesn't turn out to be a
> simple matter of compiler optimization. Where can I find the input
> file you're testing with?
http://www.linux-magazin.de/static/listings/magazin/2008/10/sprachen/
It's the sample4.txt.bz2. (8MB, expands to 55MB)

Thanks for looking into this.

Sebastian


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