Boost logo

Boost :

Subject: Re: [boost] [xpressive] Performance Tuning?
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-07-28 11:23:52


On Tue, Jul 28, 2009 at 9:05 AM, OvermindDL1<overminddl1_at_[hidden]> wrote:
> On Tue, Jul 28, 2009 at 9:00 AM, Edward Grace<ej.grace_at_[hidden]> wrote:
>>>
>>> Heh, when my brain is functional again, if I remember (or if I am
>>> reminded by this email) I will run it through a profiler and see what
>>> is going on as well as looking at the disassembly to see what kind of
>>> code it all creates.
>>
>> That would be very instructive - not something I'm really much good at
>> anymore....
>
> I used to do it all the time, editing disassembly to make programs do
> other things was always fun.  :)
> Been a while though.
>
> I do not think I have the cognitive capabilities to be able to read
> assembler at the moment, but I went ahead and profiled the
> application, results are attached to preserve formatting.
>

Well, atoi's assembly is a function call, no inlining there...

And strtol in assembly is a function call too, no inlining or anything fancy.

And heh, Spirit is completely inlined except for the call to
boost::spirit::qi::detail::extract_int<int,10,1,-1,etc...
However that function is only called the very first time that function
is called. Remember that Spirit increments the passed in iterator, so
all the start iterators in that vector ended up being incremented to
be equal to the last iterator. :p
I change the wrap_qi_parse function to this (introduced a temporary so
the temporary is incremented instead of the thing you have stored in
the vector):
void wrap_qi_parse() {
  for (int i = 0; i < BUFFER_SIZE; ++i)
  {
          char const *iter = f[i];
    qi::parse(iter, l[i], int_, v[i]);
  }

}

When I compile and run the tests now, I get this:
initializing input strings...
Calibrating overhead......done
Timer overhead (t_c) ~= : 12
Jitter ~= : 8.43769e-015
qi_parse vs atoi : 170.429 170.438 170.482% faster.
qi_parse vs strtol : 167.589 167.601 167.668% faster.
strtol vs atoi : 1.04669 1.05746 1.06165% faster.
qi_parse vs qi_parse : 0 0 0% faster.

Checking that the results are correct...
atoi is behaving itself!
strtol is behaving itself!
qi is behaving itself!

All done!

That is a *lot* more reasonable, although Spirit is still most
definitely faster then the built-in functions. :)

Heh, what do you know, my shut down brain still had some living brain
cells. I have actually found that I, oddly, do my best debugging when
really tired, at least when I was younger, guess I still do. :)


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