Python dictionary inspired hash table implementation

bearophile bearophileHUGS at lycos.com
Wed Jul 9 03:04:10 PDT 2008


Manfred_Nowak:
> Moritz Warning wrote:
> > PyDict decreases in performance for this case.
> 
> This is a hint, that PyDict may be well suited only, when the actual 
> distribution of keys over the keyspace is dense.

Python dicts contains only python objects, they are always references, so they contain only pointers, this means Python dicts are probably optimized only for keys/values 4 (and probably 8 too) bytes long each.
So the AA implementation may have to contain two versions, one for large keys and one for smaller (4-8 bytes) ones. Builtin AAs are used very often (if you are used to program in scripting languages), so this may be worth.

Bye,
bearophile



More information about the Digitalmars-d mailing list