GC-less Hash-Tables (AA)

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


On Wed, Sep 17, 2014 at 11:43:27PM +0000, "Nordlöw" via Digitalmars-d-learn wrote:
> On Wednesday, 17 September 2014 at 23:27:10 UTC, Nordlöw wrote:
> >to check if we need to use GC. If not we can use malloc/free.
> 
> Further if they key and values are all fixed-size we should probably
> use some allocator instead of malloc/free. That would make more
> efficient use of this allocation regularity, right?

Keys and values are *always* fixed sized. Either they are a fixed-sized
value type, or they are a fixed-sized reference to some object (of
reference type -- the references themselves are of course constant
sized). We don't care about managing the resources for the reference
type because that's supposed to be the user's problem.


> Is the current AA-allocator easily accessible/modifable somewhere in
> druntime?

Well, (most of) the code is in druntime src/rt/aaA.d and while it's
certainly *modifiable*, let's just say it's not a very pleasant
experience to do so. :-) There is still a lot of compiler-dependency
built into the code, and one of the major obstacles to making
significant improvements is the reliance on typeinfo's rather than
compile-time type information via templates. Ideally it should be a
fully-decoupled library implementation interfacing with the compiler via
a set API, but we're still some ways off from that right now. If you'd
like to help it reach that point, it would be most welcome, but be aware
that right now, doing things like changing the allocation scheme is not
going to be an easy change.


T

-- 
To provoke is to call someone stupid; to argue is to call each other stupid.


More information about the Digitalmars-d-learn mailing list