Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-01-30 08:23:04


From: "David B. Held" <dheld_at_[hidden]>
> "Philippe A. Bouchard" <philippeb_at_[hidden]> wrote in message
> news:b19hhg$i2m$1_at_main.gmane.org...
> > [...]
> > list shifted_ptr<T> took 7.1966276647 seconds to reconstruct 2000
times.
> > [...]
> > list shared_ptr<T> took 14.0157271000 seconds to reconstruct 2000 times.
>
> Looks like your lead is getting eroded by the day. ;) And that's just
> with a quick hack. You better be worried about a serious small
> object allocator.

To be fair, a factor of two improvement cannot just be shrugged off. But one
point to keep in mind is that

shared_ptr<X> px(new X);

performs two allocations. We can optimize the count allocation until we're
blue in the face but in a real project the whole expression will probably
remain a bottleneck; so it's likely that X will acquire a class-specific
operator new. And a X with a class-specific new can no longer be used with
shifted_ptr.


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