Boost logo

Boost :

Subject: Re: [boost] [xint] Third release is ready, requesting preliminary review
From: Jeffrey Lee Hellrung, Jr. (jhellrung_at_[hidden])
Date: 2010-05-02 19:20:56


On 05/02/2010 02:02 PM, Chad Nelson wrote:
> On 05/02/2010 04:19 PM, Jeffrey Lee Hellrung, Jr. wrote:
[...]
>> Because COW is not thread-safe ;) And I'm very curious how this speed
>> "boost" (pun intended?) has come about.
>
> I've just posted the results of my testing. As to *why* it's that much
> faster, I can only provide educated guesses.

I think it is important to understand what the discrepancy is, because
it may be that you're not writing your algorithms in a move-aware way,
producing copies unnecessarily. This wouldn't surprise me if you wrote
the original implementations with COW primarily in mind (which I can't
blame you for).

[...]
>> The only example I can think of where COW might come in handy is if you
>> do something like
>>
>> cow* p_x1 = new cow();
>> cow* p_x2 = new cow(*p_x1); // no deep copy / shared ownership
>> // ... [A] Read from *p_x1, maybe? ...
>> delete p_x1; // *p_x2 now has exclusive ownership
>
> If I read your example correctly, then that's about what I was thinking
> of: algorithms that have to start with a copy of one or more of the
> passed-in parameters, but then need to modify it/them. The division
> algorithm requires this, just as one example off the top of my head.

Hmmmm...I'm not quite sure what you mean. Maybe I'll take a look at
your implementation of division.

>> So, bottom line: Give me a real example of an algorithm where COW
>> gives superior performance to move semantics, and I'll buy into the
>> COW implementation.
>
> I'll give you one better: the actual timings, which you can reproduce
> yourself if you doubt their accuracy. :-) Just let me know if you want
> the code I used to come up with them... the rules I read say that I'm
> not supposed to post any files to this list, so if you want them, I'll
> need to upload the changes somewhere.

I'll take a look at the performance testing code when I get a chance,
but I'm guessing a problem *could* be that you're not maximizing the
opportunities to moven from or otherwise modify temporaries.

- Jeff


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