GC-less Hash-Tables (AA)

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 17 16:44:13 PDT 2014


On Wed, Sep 17, 2014 at 11:27:08PM +0000, "Nordlöw" via Digitalmars-d-learn wrote:
> On Wednesday, 17 September 2014 at 22:56:17 UTC, H. S. Teoh via
> Digitalmars-d-learn wrote:
> >Slots come from the GC heap, but in theory it could come from any
> >allocator, potentially even malloc/free, since the lifetime of the
> >Slots
> 
> So I guess there is room for some optimizations here right?
> 
> We could use, for instance,
> 
> http://dlang.org/phobos/std_traits.html#hasIndirections
> 
> to check if we need to use GC. If not we can use malloc/free.
> 
> Couldn't such an enhancement give significant speed-ups for small
> key-value allocations?

All of this has been thought of before. The big obstacle is that right
now, the AA implementation is split across dmd hacks, druntime, and
object.di, and relies on typeinfo's rather than compile-time type
information, so it's not easy to implement these improvements. Recently,
there has been a slow but steady trickle of pull requests that have
begun to address the implementation issues, and hopefully in the
not-so-distant future we will be able to finally decouple the AA
implementation from dmd, and stand a fighting chance of moving it into a
library implementation. Once it's in the library, the improvements you
mention will be trivial to implement.


T

-- 
Help a man when he is in trouble and he will remember you when he is in trouble again.


More information about the Digitalmars-d-learn mailing list