Boost logo

Boost :

Subject: Re: [boost] [xint] Boost.Move vs Copy-on-Write timings
From: Jeffrey Lee Hellrung, Jr. (jhellrung_at_[hidden])
Date: 2010-05-04 01:32:56


[I seem to have lost the original email with the timings comparing COW
and move semantics, which was probably the proper email to reply to keep
the thread-tree correct, but I'm hoping this is close enough...]

On 05/02/2010 03:53 PM, Chad Nelson wrote:
> On 05/02/2010 05:10 PM, vicente.botet wrote:
>> Could you share the test programm so we can test with other compilers
>> or architectures?
>
> Certainly. I've just uploaded the updated code to the sandbox, at
> <https://svn.boost.org/svn/boost/sandbox/xint>. See the new PERFORMANCE
> TESTING.txt file in the main directory for information on reproducing
> the tests.
[...]

I've looked briefly through the code. I'm not entirely sure where all
the "base" arithmetic functions are defined, but I do see that
primitives.cpp contains at least some of them. It seems like the
general template you're using is

void function(base_integer& target, const base_integer& argument0, const
base_integer& argument1, ...)
{
     integer result;
     // ...populate result with the...well...result of the function...
     result._cleanup();
     target._attach(result);
}

With only guesses as to the semantics of _cleanup and _attach (perhaps
you can help in that regard), I suspect, in the absence of COW and
regardless of movability of integer and base_integer, you'd be making
spurious and unneeded copies of the result. Can you please explain the
rationale for the intermediate "result" integer, when you have the
"target" reference sitting right there from the get-go? Does this have
to do with base_integer trying to account for both fixed-width and
variable-width integers?

- Jeff


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