Subject: Re: [boost] [Block Pointer] benchmark
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2011-05-25 16:39:12
-----BEGIN PGP SIGNED MESSAGE-----
On Wednesday, May 25, 2011, Phil Bouchard wrote:
> So we have shared_ptr being initialized with an object created by
> operator new. shared_ptr will then allocate another reference counter.
> 2 allocations is faster than the make_shared counterpart so yes
> copying a pointer is slower than 2 heap allocations.
What version of boost are you referring to? make_shared used to be slow due
to it doing a lot of unnecessary copying of the storage area for the
pointee, but that should have been fixed probably a couple years back now.
Copying a shared_ptr is fairly slow due to the atomic reference counting,
but I would expect a compiler to be able to elide the copy of the
make_shared return value.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
-----END PGP SIGNATURE-----
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk