Boost logo

Boost :

Subject: [boost] shared_ptr/shared_count and the cost of use counter allocation
From: Hendrik Schober (spamtrap_at_[hidden])
Date: 2008-09-08 14:04:48


Hi,

I have taken the task to replace a proprietary smart pointer (a
fork of an earlier 'shared_ptr' variant) used in a library used
for rendering of 3D scenes by the boost's current 'shared_ptr'.
The reason is that I have found a couple of syntactic problems
with the proprietary smart pointer that 'shared_ptr' doesn't have.
While I succeeded syntactically, in certain performance tests the
proprietary smart pointer performs about 20 times better than
'shared_ptr'. It seems that this is caused by the allocation of
the use counter. For the proprietary smart pointer this allocation
can be tweaked by passing allocators as template arguments, while
'shared_ptr' seems not to allow this. I have yet to find out what
that performance difference means for real projects, but according
to those familiar with the library the reason the allocators where
introduced is that there's code that very extensively creates and
destroys smart pointers which suffered badly from allocation costs.

Is there a way for me to tweak 'shared_ptr's performance other than
by again forking into a proprietary smart pointer and introducing
allocators for that one? or is there any interest in the boost
community for doing this?

Thanks,

Schobi


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