|
Boost : |
Subject: Re: [boost] [Block Pointer] benchmark
From: Phil Bouchard (philippe_at_[hidden])
Date: 2011-05-25 17:23:21
On 5/25/2011 1:39 PM, Frank Mori Hess wrote:
>
> What version of boost are you referring to?
boost_1_46_1
> 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.
That optimization doesn't exist and it's worse with the Intel Compiler:
$ bin/benchmark.test/intel-linux/release/benchmark
make:
auto_ptr: 9406481 ns
shared_ptr: 24266241 ns
block_ptr: 126199145 ns
new:
auto_ptr: 4637891 ns
shared_ptr: 11943452 ns
block_ptr: 73166351 ns
$ bin/benchmark.test/gcc-4.1.2/release/benchmark
make:
auto_ptr: 10980716 ns
shared_ptr: 15384949 ns
block_ptr: 118651908 ns
new:
auto_ptr: 4608425 ns
shared_ptr: 10733654 ns
block_ptr: 69710242 ns
-Phil
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk