|
Boost : |
Subject: Re: [boost] [xint] Third release is ready, requesting preliminary review
From: Chad Nelson (chad.thecomfychair_at_[hidden])
Date: 2010-05-03 18:52:34
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 05/03/2010 06:37 PM, Jeffrey Lee Hellrung, Jr. wrote:
>> [...] I just realized that, since I have the boost::move calls
>> wrapped in a #define already, it would be easy to check on that, so
>> I did. The timings all indicate that without the boost::move() call
>> for the return values, XInt runs as if Boost.Move weren't even
>> there. So the boost::move call *is* required to get the benefits of
>> emulated move semantics, as I originally thought.
>
> Sorry, I *definitely* should've added that, as far as I know, RVO
> generally requires a single, simple return statement. If you have
> multiple returns, or a return expression more complicated than
> "return foo;" or "return T(bar,zap);", then I don't think RVO
> typically kicks in. Can you confirm or deny this to be the case? If
> it is, then the move(...) calls or COW will almost certainly be
> necessary to get optimal performance.
In the cases I'm looking at, there are usually only three lines in the
function: a declaration of an integer to hold the return value, a call
to a function in the detail namespace to do the operation (with the
return value object as a parameter), and a return of the return value.
- From what you're saying, RVO should be easy for the compiler to use, but
the boost::move call on that return value is still required to get the
benefits of move semantics.
(That three-line function design is what is preventing the move
semantics from working as well as they could, I'm pretty sure. I haven't
had enough time to confirm that yet though.)
- --
Chad Nelson
Oak Circle Software, Inc.
*
*
*
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkvfU7IACgkQp9x9jeZ9/wT9pwCfYczPIAy9k6CRzSnw2H3eZZCv
CfQAoM0X8ozVCdeM+yISDb+AKo9sGb/Y
=oLXq
-----END PGP SIGNATURE-----
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk