Subject: Re: [boost] [xpressive] Performance Tuning?
From: Edward Grace (ej.grace_at_[hidden])
Date: 2009-07-19 07:27:52
> 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++.
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,
I haven't been able to try compiling the attached modification to
your code myself as I don't have the boost spirit libraries. Even if
I did it still wouldn't be your machine! Since I can't compile it
there *will* be some errors! The ugly global variables are sadly an
unavoidable side effect at the moment.
I have pared down the number of iterations quite significantly. The
generic_timer makes repeated calls to the functions under test - as
many as necessary to 'get the job done' - so there's no need to have
large run-times in order to effectively get an average time.