Boost logo

Boost :

Subject: Re: [boost] [Block Pointer] Up to 600% faster than Shared Pointer
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2016-03-13 00:00:05

On Sat, Mar 12, 2016 at 10:12 PM, Phil Bouchard wrote:
> On 03/12/2016 09:22 PM, Glen Fernandes wrote:
>> To add to our earlier discussion, you should also include the
>> benchmark for allocate_shared() with fast_pool_allocator.
> Good point, I was not aware it could be used this way. I just added
> fast_pool_allocator<>() to the benchmark so now the comparison is fair and
> block_ptr<> still is faster by 125%:

Hi Phil,

The other thing I observed in your benchmarks is the distinction
between 'new T' and 'new T()'. i.e. make_shared() and
allocate_shared() (and make_unique() too) all value-initialize. 'new
T' (and T is 'int' in your example) is default-initialization (while
'new T()' would be value-initialization).

You can use boost::make_shared_noinit() and
boost::allocate_shared_noinit() (and boost::make_unique_noinit() also)
if you want default-initialization. Or you can use 'new T()' instead
of 'new T' and have value-initialization.

(I haven't looked at the implementation of block_ptr yet, or the
design, or the purpose of it, I just saw the thread on benchmarks and
examined your benchmark program source).


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