This is the mail archive of the
mailing list for the libstdc++ project.
Re: Pool allocators, the Next Generation
- From: Phil Edwards <phil at jaj dot com>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: libstdc++ at gcc dot gnu dot org, stefan at snon dot net
- Date: Tue, 4 Mar 2003 15:43:20 -0500
- Subject: Re: Pool allocators, the Next Generation
- References: <20030220193831.GA11586@disaster.jaj.com> <20030225074841.GA7252@disaster.jaj.com> <firstname.lastname@example.org>
On Tue, Feb 25, 2003 at 09:16:00AM +0100, Gabriel Dos Reis wrote:
> Phil Edwards <phil at jaj dot com> writes:
> | A brief progress report: One experimental version is done and working.
> | It maintains parity in the current allocator settings, and allows us to
> | delete pthread_allocimpl.h entirely. A new typedef, __gthread_alloc, sits
> | alongside __alloc and __single_client_alloc, with all the major features of
> | pthread_alloc and the added bonus that it follows the --enable-threads=xxx
> | decisions.
> | Bunch of other cleanups, e.g., more behind-the-scenes stuff moved from
> | std into __gnu_cxx.
> | The major downside: There are virtual function calls in the critical path.
> | I still need to do lots of timing tests before I'll even begin to suggest
> | this approach, and even then it would be with a plea for assistance to
> | help get rid of them.
> [Thinking loudly] If the decision of which allocator category to use
> is made at configure time or compile time, then I will suggest we use
> traits to get rid of the virtual calls.
Yes, that's the goal. In fact, that's how I got this far.
The issue is that the default pool allocator is "instanceless" and
using only statics. The per-thread pool allocator uses per-object data.
Getting to that per-object data required some hoop-jumping.
At some point I plan to convert the virtual calls into non-virtual ones by
using combinations of traits and pointers, but doing so without imposing
a penalty on the default code path is going to be hard.
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace. We seek
not your counsel, nor your arms. Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen. - Samuel Adams