Boost logo

Boost :

Subject: Re: [boost] shared_ptr/shared_count and the cost of use counter allocation
From: Michael Marcin (mike.marcin_at_[hidden])
Date: 2008-09-10 12:30:08

Emil Dotchevski wrote:
> On Wed, Sep 10, 2008 at 2:29 AM, Hendrik Schober <spamtrap_at_[hidden]> wrote:
>> In the end I just #define'd 'BOOST_SP_USE_QUICK_ALLOCATOR' and on my
>> platform that was faster than 3 out of 4 of the proprietary allocators
>> used. So I'll go ahead and test this on the other platforms we need.
>> If it works just as well there, I'll merge my changes into the trunk.
> Also, make_shared could be used to get rid of the separate allocation
> for the count. This may make it unnecessary to define

And if its implemented the way I would imagine it would be it should
also improve locality of reference and minimize false sharing when when
working with your shared pointers which should improve performance
especially on multi-core systems with multi-threaded programs.

If the sp pool is implemented in a typical fashion you'd probably get a
lot of false sharing when working with shared_ptrs and maybe even hurt
performance over the naive allocator.

Of course this is all just conjecture on my part I haven't looked at the


Michael Marcin

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