|
Boost : |
From: townerj_at_[hidden]
Date: 2003-08-08 00:37:08
----- Original Message -----
From: "Douglas Gregor" <gregod_at_[hidden]>
Newsgroups: gmane.comp.lib.boost.devel
Sent: Tuesday, August 05, 2003 8:32 PM
Subject: Re: what happened to allocators in boost?
> The allocator design focused on the benefits one could get from
specialized
> allocators for containers, e.g., data structures that may allocate large
> chunks of memory that are expected to be used together. They don't really
> give us much for components like shared_ptr that allocate one thing (and
> note that shared_ptr does not allocate the pointer it stores, although it
> does allocate a reference count). boost::function supports an allocator
> argument, but the C++ committee is considering removing this allocator
from
> the library TR version of function<> for precisely this reason.
>
> Doug
>
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.:
std::vector<boost::shared_ptr<double> > myDoubleVector(10000);
I personally think that the benifits are still there, and with things such
as template typedefs and template aliases being introduced by the
standards commitee, using templates with a lot of arguments may be
less painful.
Jesse Towner
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk