Boost logo

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?


> 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
auto_ptr: 9406481 ns
shared_ptr: 24266241 ns
block_ptr: 126199145 ns

auto_ptr: 4637891 ns
shared_ptr: 11943452 ns
block_ptr: 73166351 ns

$ bin/benchmark.test/gcc-4.1.2/release/benchmark
auto_ptr: 10980716 ns
shared_ptr: 15384949 ns
block_ptr: 118651908 ns

auto_ptr: 4608425 ns
shared_ptr: 10733654 ns
block_ptr: 69710242 ns


Boost list run by bdawes at, gregod at, cpdaniel at, john at