From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Ada containers and custom allocators
Date: Sat, 12 Jan 2008 10:59:28 -0500
Date: 2008-01-12T10:59:28-05:00 [thread overview]
Message-ID: <wcck5mfghlr.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 2d464e2f-b043-4d45-8abd-ca392e92b4f3@i29g2000prf.googlegroups.com
Maciej Sobczak <see.my.homepage@gmail.com> writes:
> On 11 Sty, 23:41, Robert A Duff <bobd...@shell01.TheWorld.com> wrote:
>
>> Why does it give spectacular performance improvements?
>> Doesn't this indicate that the default storage management
>> is needlessly inefficient?
>
> Default storage management is always needlessly inefficient, because
> it is general and cannot benefit from any additional knowledge about
> what will be allocated. Every single bit of additional knowledge is an
> improvement opportunity in some area. Fixed-size allocators can use
> faster algorithms than general allocators.
True, but the container implementation knows whether it is allocating
fixed-size objects.
> Another axis of improvement with custom allocators is thread-safety.
Good point. I'd like to have a language where the compiler can tell
which objects are shared by more than one thread. But that's not Ada
(nor is it C++).
> The global allocator cannot assume anything about threading and has to
> be defensive in relation to threads, which means that it has to
> proactively synchronize everything, always - just in case.
You don't necessarily have to lock every allocation and deallocation.
There are more efficient schemes, but you're right -- there is a
cost.
- Bob
next prev parent reply other threads:[~2008-01-12 15:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-07 15:48 Ada containers and custom allocators Maciej Sobczak
2008-01-07 16:29 ` Dmitry A. Kazakov
2008-01-08 1:54 ` Randy Brukardt
2008-01-08 7:59 ` Maciej Sobczak
2008-01-08 23:54 ` Randy Brukardt
2008-01-09 8:56 ` Dmitry A. Kazakov
2008-01-09 15:29 ` Robert A Duff
2008-01-09 17:09 ` Dmitry A. Kazakov
2008-01-09 21:58 ` Robert A Duff
2008-01-10 10:12 ` Dmitry A. Kazakov
2008-01-11 5:00 ` Randy Brukardt
2008-01-09 15:28 ` Robert A Duff
2008-01-11 5:00 ` Randy Brukardt
2008-01-11 21:02 ` Maciej Sobczak
2008-01-11 22:41 ` Robert A Duff
2008-01-12 13:40 ` Maciej Sobczak
2008-01-12 15:59 ` Robert A Duff [this message]
2008-01-09 1:17 ` Jeffrey R. Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox