|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-08-09 07:45:40
townerj_at_[hidden] wrote:
>
> Hi there. I believe that components such as shared_ptr could still
> benifit from allocators that are shared at the class level; for
> example, a singleton pool allocator could be used by all instances of
> the shared_ptr template. Loki uses exactly this, and it gains a
> performance increase of ~100%
> compared to using the standard ::operator new and ::operator delete
> under MSVC++.NET 2003, when constructing and destructing lots of
> shared_ptr objects (or to be more accurate, shared_count objects),
> i.e.:
This is a problem with MSVC's ::operator new, not with shared_ptr's
interface. Many compilers already have an optimized small object allocator.
Use #define BOOST_SP_USE_QUICK_ALLOCATOR if count allocation is a
bottleneck, but keep in mind that this won't help the rest of "new X"
allocations.
> std::vector<boost::shared_ptr<double> > myDoubleVector(10000);
This line doesn't allocate any counts, BTW.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk