|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-08-10 13:01:20
From: "Peter Dimov" <pdimov_at_[hidden]>
> From: "Philippe A. Bouchard" <philippeb_at_[hidden]>
> > Hi,
> >
> > Here is the proof ptr<> is faster and requires a lot less memory
than
> > shared_ptr<>.
> >
> > The results speak from themselves:
> > http://groups.yahoo.com/group/boost/files/ptr/
> >
> > I know I don't take care of exceptions, but even with that the
numbers
> > start doubling or quadrupling...
>
> Philippe, try using #define BOOST_DISABLE_THREADS to get a fair
comparison.
> Looking at the times, I get the feeling that shared_ptr is using the
thread
> safe path. Apologies if this is not the case.
Some more comments. Using <type_traits.h> prevents ptr.h from working on
anything that doesn't use the SGI STL.
The implementation is pretty clever. I _think_ that the whole shared_ptr
spec can be implemented using your idea... if I were a standard library
implementor writing a std::shared_ptr I'd definitely consider using the
memory block header to store the data. :-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk