On 03/12/2016 09:22 PM, Glen Fernandes wrote:
On Sat, Mar 12, 2016 at 9:08 PM, Phil Bouchard
wrote: Also block_ptr<> is now distinct from the allocator used.
Finally the class fastblock<> is properly abstracted and it is easy to add user defined block types just like this one:
template <typename T> class fastblock : public block
Hi Phil,
To add to our earlier discussion, you should also include the benchmark for allocate_shared() with fast_pool_allocator.
1. shared_ptr (new) 2. shared_ptr (make_shared) 3. shared_ptr (allocate_shared with fast_pool_allocator) 4. block_ptr 5. block_ptr (fastblock) 6. unique_ptr/auto_ptr (new/make_unique)
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%: make: auto_ptr: 27539691 ns shared_ptr: 31368593 ns alloc: shared_ptr: 10995612 ns <- new: auto_ptr: 22648835 ns shared_ptr: 48179069 ns block_ptr: 8775982 ns <- Not to mention the code is more elegant using operator new. -Phil