Better AAs
w0rp via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jul 6 23:59:50 PDT 2014
I wrote my own hashmap a little while ago for fun, and also
because I couldn't get @safe pure nothrow ranges through maps at
the time, and it turned out that I could also add in @nogc too
for the ranges and a lot of functions, so I could make a lot of
my graph types also provide the same guarantees.
https://github.com/w0rp/dstruct/blob/master/source/dstruct/map.d
Maybe there's something in there which might be useful to someone
else. Maybe I did something horribly wrong for which I must be
punished.
One thing I did find interesting is the results I got from
following the OpenJDK method of computing an index in the bucket
with hash & (length - 1). Because my bucket lengths are always
powers of 2, the 'bitwise and' achieves fairly uniform
distribution from what I can tell without needing to execute
division, which can be slow.
More information about the Digitalmars-d
mailing list