Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-11-15 10:54:46


Matthew Wilson wrote:
> Hi Boosters
>
> I'm just doing some research on reference-counting, and contrasting
> self-counting types with externally counted types, the latter
> effected with the rather excellent shared pointer technique.
>
> [As a side question, is it true that Nicolai Josuttis was the
> inventor of the technique?]

Which specific technique do you have in mind?

> Naturally, one of the shared pointer's I've used is
> boost::shared_ptr. The measurements have demonstrated some surprising
> performance characteristics for shared_ptr in particular, and I want
> to solicit the opinion of the expert's here before I make any bold
> claims, as some results are just too surprising for me to trust them.
>
> There are five types tested.
>
> 1. A self-counting type, using an ancient Synesis (my company)
> template ref-counting bolt-in class
> 2. A self-counting type, using a custom-written (for this test)
> template ref-counting bolt-in class
> 3. Externally counting, using boost::shared_ptr
> 4. Externally counting, using a custom-written (for this test) shared
> pointer type
> 5. Externally counting, using a custom-written (for this test) shared
> pointer type, which has a custom allocator for the shared count
> members

Based on the results below, I assume that 4 & 5 do not support weak pointers
and probably use atomic integer instructions for the count updates?

You may be interested in adding:

6. boost::intrusive_ptr

7. shared_ptr, but with #define BOOST_SP_USE_QUICK_ALLOCATOR

8. shared_ptr, but with detail/shared_count.hpp replaced with

    http://www.pdimov.com/cpp/shared_count_x86_exp2.hpp

to the list.

Would it be possible for you to share the source of the benchmarks?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk