|
Boost : |
Subject: Re: [boost] Boost.Convert. Take 2.
From: Rob Stewart (robertstewart_at_[hidden])
Date: 2014-02-21 05:31:51
On February 21, 2014 3:12:08 AM EST, Vladimir Batov <vb.mail.247_at_[hidden]> wrote:
>Rob Stewart <robertstewart <at> comcast.net> writes:
>> On February 20, 2014 6:27:42 PM EST, Vladimir Batov <Vladimir.Batov
><at>
>constrainttec.com> wrote:
>>
>> >I am especially surprised by the fact that its performance seems
>> > quite adequate (without any optimization):
>> [snip]
>> >tests. On the other hand the test could not be any more
>> >straightforward:
[snip]
>> I assume you're timing an optimized build, on which case you are
>being
>misled by the optimizer because
>> you're not using the results of the conversions.
>
>Rob,
>
>Nice hearing from you. I had that suspicion also and I do not think
>optimization was at play. The reason is that I timed twice with "-g"
>and
>without and definitely did not have optimization flags (never use
>them). And
>it's hard not to notice when the code is optimized -- stepping through
>is,
>well, difficult. :-)
Using -g simply includes symbols. It has nothing to do with optimizations. Not testing with optimizations is not worthwhile. sprintf() is highly tuned and C++ code relies on inlining, copy elision, etc. Users of your library will certainly use it with optimizations.
> Secondly, my actual code is different (for the
>post I
>cut it to bare minimum). All loops are actually like
>
>for (int k = 0; k < local::num_cycles; ++k)
>{
> int k = boost::convert<int>::from("12345", ccnv).value();
> BOOST_ASSERT(k == 12345);
>}
>
>Do you think there still might be something I missed?
The assertion won't help in an optimized build, of course. Save the values and print them at the end, after you've captured the elapsed times.
___
Rob
(Sent from my portable computation engine)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk