Subject: Re: [boost] [Block Pointer] benchmark
From: Nevin Liber (nevin_at_[hidden])
Date: 2011-05-25 01:52:30
On 24 May 2011 18:52, Phil Bouchard <philippe_at_[hidden]> wrote:
> On 5/24/2011 4:07 PM, Nevin Liber wrote:
>> Your claim is " It is a fast as the popular smart pointer *
>> boost::shared_ptr<T>*". Yet, in single-threaded code and shared_ptr using
>> new instead of make_shared, block_ptr still takes 3.3x as long as
>> That is *a lot* of overhead...
> I just tested it using make_shared & make_block and I get:
> auto_ptr: 11109841 ns
> shared_ptr: 21215277 ns
> block_ptr: 143637475 ns
> auto_ptr 4583447 ns
> shared_ptr: 10675000 ns
> block_ptr: 67152785 ns
> FYI make_shared is slower than new because of the temporary it creates. If
> people what speed they should stick to operator new in all cases.
Heck, even auto_ptr is significantly faster using new instead of make_shared
and make_block. Simply amazing! Wait, ... how exactly did you use
make_shared and make_block in the auto_ptr case?
And that isn't nearly as amazing as your assertion that an increment and
decrement of a reference count (which is all that a shared_ptr "temporary"
translates into) is not only slower, but *significantly* slower than a heap
allocation/deallocation in the standard heap.
-- Nevin ":-)" Liber <mailto:nevin_at_[hidden]> (847) 691-1404
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk