comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Ada containers and custom allocators
Date: Sat, 12 Jan 2008 05:40:31 -0800 (PST)
Date: 2008-01-12T05:40:31-08:00	[thread overview]
Message-ID: <2d464e2f-b043-4d45-8abd-ca392e92b4f3@i29g2000prf.googlegroups.com> (raw)
In-Reply-To: wccve60t278.fsf@shell01.TheWorld.com

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.

Another axis of improvement with custom allocators is thread-safety.
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. Now imagine
you have a container and you know by the design of your system that
this given container will be always used in the context of a single
thread. Why not give it a separate allocator that benefits from this
knowledge (ie. operates on a separate, non-synchronized pool)? On
multicore or multiprocessor systems unnecessary synchronization
(memory barriers and such) is *VERY* expensive and can kill
performance. Why not make things easier for the hardware by reducing
the number of unnecessary membars?
Here, again - every single bit of additional knowledge is an
improvement opportunity.

Related note: it was repeated many times on this groups that Ada is
particularly appropriate for the coming multicore era. I'm not so sure
about this and the above issue is one of the question marks. Forget
about performance if you cannot partition allocation schemes for
containers by threads. This will get only worse as the number of cores
in CPUs increases.

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com



  reply	other threads:[~2008-01-12 13:40 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 [this message]
2008-01-12 15:59                 ` Robert A Duff
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