Boost logo

Boost :

Subject: Re: [boost] [xint] Boost.Move vs Copy-on-Write timings
From: Chad Nelson (chad.thecomfychair_at_[hidden])
Date: 2010-05-02 19:04:30

Hash: SHA1

On 05/02/2010 06:43 PM, Peter Dimov wrote:

>> Times are measured in seconds, using two sets of ten 2048-bit integers.
>> The tests consisted of adding each of those pairs of numbers together
>> 10,000 times, multiplying them 10,000 times, and doing a "mulmod"
>> operation on them (with a third randomly-generated 2048-bit modulus
>> argument) 1,000 times. Each test was run three times, under as close to
> Move semantics can optimize away some allocations that copy on write
> can't, such as for example
> w = x * y + z;
> (assuming that x*y already has enough bits to store x*y+z).

The copy-on-write code should optimize that allocation away too, under
those circumstances.

> But it doesn't have to be either-or; you can move even when copy on
> write is used.

I tested that in my original tests, but it didn't seem to be useful. The
results were halfway between move-only and copy-on-write-only, so I
eliminated it for this round.
- --
Chad Nelson
Oak Circle Software, Inc.
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla -


Boost list run by bdawes at, gregod at, cpdaniel at, john at