Boost logo

Boost :

Subject: Re: [boost] [xpressive] Performance Tuning?
From: Joel de Guzman (joel_at_[hidden])
Date: 2009-07-19 09:16:28

Edward Grace wrote:
>> This is somewhat cheating. We've tuned the numeric parsers of Spirit
>> with TMP tricks, loop unrolling, etc. Those are very finely tuned
>> numeric parsers you see there that beats the fastest C code such as
>> strtol and atoi. The following benchmarks reveal 2X+ speed against
>> low level strtol and atoi (attached). I am getting:
>> atoi: 0.82528 [s]
>> strtol: 0.792227 [s]
>> int_: 0.358016 [s]
>> The first and second are the low-level C routines. The third is
>> Spirit's int_ parser. I need not mention that the C routines only
>> accept C strings while the Spirit int_ parser can accept any
>> forward iterator. So, in a sense, we're comparing apples and
>> oranges. But this goes to show that you can write highly optimized
>> code in generic C++.
> Dear Joel,
> Would you mind trying out these examples with my timer? I'd like to see
> if it gives sensible answers for other people's code on other people's
> machines. Attached is a reworking of your testbed code using my timer
> which can be obtained from boost vault,

Hi Edward,

I tried a quick shot at it. There are compilation errors indeed.
Please try to fix the errors first (*). You can get Spirit by getting
the Boost trunk off SVN.

(*) Also, please make sure you try it on Windows too. E.g. <sys/time.h>
is non-standard, AFAIK. My main compiler is VC9. Your library is
intended to be cross platform, right?


Joel de Guzman

Boost list run by bdawes at, gregod at, cpdaniel at, john at