Associative Arrays max length? 32bit/64bit
FG via Digitalmars-d
digitalmars-d at puremagic.com
Sat May 17 13:18:07 PDT 2014
On 2014-05-17 21:35, bearophile wrote:
> FG:
>
>> and don't forget the extra memory needed to store the tree for fast key look-up in the hash array.
>
> I think D now uses a linked list for the collision chains (so opCmp is useless, despite it's still required for the hashing protocol).
Indeed, I just read https://github.com/D-Programming-Language/dmd/blob/master/src/backend/aa.c
Key hash is divided modulo the number of buckets and each bucket points to an ordered double-linked list. That list is walked left or right depending on what value Typeinfo::compare returns for two keys. Hmm... isn't opCmp used by that function? Why useless?
More information about the Digitalmars-d
mailing list