Boost logo

Boost :

Subject: Re: [boost] [xint] Boost.XInt formal review
From: Chad Nelson (chad.thecomfychair_at_[hidden])
Date: 2011-03-05 13:53:53


On Fri, 4 Mar 2011 20:23:33 +0300
DE <satan66613_at_[hidden]> wrote:

> hi all
> congratulations for you, chad, on that you got so far
> i hope all your effort will pay back you a good value

Thanks! I hope so too. :-)

> i wanted to say a word on the copy-on-write thing
> as someone wisely noted on this list cow is in no way worse than plain
> copying
> in general when you make a copy you allocate new storage for the newly
> created copy
> and the allocation procedure, in general, locks a mutex in order not
> to corrupt the heap
> this is much more expensive even than atomic reference counting
> this only statement convinces me personally to use cow in newly
> created pieces of software [...]

I hadn't even considered the probable mutex on the heap. The OS can
likely make use of faster mutexes than ring-three code, but they'd
still take time.

However, as has been correctly pointed out, XInt does a lot of
copy-by-value where it provides no benefit. After I change that, we'll
see whether it's still as fast or faster with the copy-on-write code
than without it. If there's no provable benefit to it on any common
platform, I see no reason to keep it.

> in the end i have a question to chad: for what reason integer_t
> inherits its implementation *virtualy* ?
> you know that virtual inheritance involves (possibly unneeded)
> overhead

Because many (all?) of the classes it inherits from have to have access
to the same data, so they all inherit from the same base class. The
"virtual" there tells the compiler that all of those inheritances come
from a single instance of the base class, rather than a separate one in
every case.

I believe this use of virtual results only in compile-time overhead.
Logically there shouldn't be any need for the run-time code to even
notice that virtual was used there. But there may be more going on
behind the scenes than I'm aware of.

-- 
Chad Nelson
Oak Circle Software, Inc.
*
*
*



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