|
Boost : |
Subject: Re: [boost] [xpressive] Performance Tuning?
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-07-18 22:09:43
On Sat, Jul 18, 2009 at 7:50 PM, Hartmut Kaiser<hartmut.kaiser_at_[hidden]> wrote:
>> >> OvermindDL1 wrote:
>> >>>
>> >>> Parsing: 42.5
>> >
>> > <snip>
>> >>>
>> >>> spirit-grammar(threadsafe/reusable): 3.1393
>> >>
>> >> Thank you for pulling this together. Would you mind sharing your
>> test
>> >> suite?
>>
>> Er, I meant to attach it, it is attached now. :) It requires Boost
>> trunk, and the timer file hpp I include is part of the Boost.Spirit2.1
>> examples/test/somewhere_in_there area, but I included it with my cpp
>> file too so you do not need to hunt for it.
>> The defines at the top control what parts to compile or not, 0 to
>> disable compiling for that part, 1 to enable it.
>>
>> My build is built with Visual Studio 8 (2005) with SP1. Compiler
>> options are basically defaults, except getting rid of the secure crt
>> crap that Microsoft screwed up (enabling that crap slows down Spirit
>> parsers on my system, a *lot*). The exe I built is in the 7zip file
>> attached. As stated, I have heard that Visual Studio handles template
>> stuff like Spirit better then GCC, so I am very curious how GCC's
>> timings on this file would be. There are still more changes to make
>> that I intend to make, but I really want the original code in a way
>> that I can use it.
>> To be honest, I had to change the core::to_number lines (commented
>> out) to boost::lexical_cast (right below the commented version), so the
>> xpressive version could be slightly faster if I actually had the
>> implementation of core::to_number available, and core::to_number was
>> well made. The xpressive code also throws a nice 100 line long warning
>> in my build log, all just about a conversion warning from double to
>> int_64, no clue how to fix that, I do not know xpressive, so I would
>> gladly like it if someone could get rid of that nasty warning in my
>> nice clean buildlog. In my compiler, my Spirit2.1 grammar builds
>> perfectly clean, I would like it if xpressive was the same way.
>
> Here are my results (platform: Windows7, Intel Core Duo(tm) Processor,
> 2.8GHz, 4GByte RAM), I reduced the number of iterations to 1e6.
>
> VC8SP1/32Bit
> Loop count: 1000000
> Parsing: 42.5
> xpressive: 4.53867
> spirit-quick(static): 0.213174
> spirit-quick_new(threadsafe): 0.255517
> spirit-grammar(threadsafe/reusable): 0.228167
>
> VC10 beta/32Bit:
> Loop count: 1000000
> Parsing: 42.5
> xpressive: 4.68044
> spirit-quick(static): 0.245641
> spirit-quick_new(threadsafe): 0.279981
> spirit-grammar(threadsafe/reusable): 0.252697
>
> VC10 beta/64Bit:
> Loop count: 1000000
> Parsing: 42.5
> xpressive: 3.7877
> spirit-quick(static): 0.17625
> spirit-quick_new(threadsafe): 0.175377
> spirit-grammar(threadsafe/reusable): 0.137707
>
> gcc 4.4.1 (MinGW)/32bit
> Loop count: 1000000
> Parsing: 42.5
> xpressive: 13.5003
> spirit-quick(static): 0.274027
> spirit-quick_new(threadsafe): 0.261029
> spirit-grammar(threadsafe/reusable): 0.325813
>
> gcc 4.4.1 (MinGW)/64bit
> Loop count: 1000000
> Parsing: 42.5
> xpressive: 10.2381
> spirit-quick(static): 0.0868965
> spirit-quick_new(threadsafe): 0.0820163
> spirit-grammar(threadsafe/reusable): 0.228892
>
> Regards Hartmut
Very nice and detailed, thanks.
I just changed the file to use spirit for parsing where I had used
lexical_cast got very different timings for xpressive now, so now,
with xpressive using a bit of spirit I get:
Loop count: 10000000
Parsing: 42.5
xpressive: 15.4841
spirit-quick(static): 3.01117
spirit-quick_new(threadsafe): 3.10548
spirit-grammar(threadsafe/reusable): 3.81694
Vast increase, 3x faster xpressive is now.
Also, how do you fix that rather bloody massive warning about
double->int64 truncation?
I also changed all int64_t to boost::long_long_type since they are the
same thing anyway (on 32-bit at least?), as well as it being
multi-platform unlike int64_t.
My changed file is attached. Do not know if this is considered
cheating now that xpressive is using some spirit now. ;-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk