Associative Arrays need cleanout method or property to help garbage collection

Moritz Warning moritzwarning at web.de
Tue Mar 16 09:12:25 PDT 2010


On Tue, 16 Mar 2010 04:41:55 +0000, Michael Rynn wrote:

> The use of built in Associative Array can have deleterious effects on
> Garbage Collection.
 :(


Fwiw, here is the original Python Dictionary implementation:
http://svn.python.org/projects/python/trunk/Objects/dictobject.c
This is also a nice read:
http://svn.python.org/projects/python/trunk/Objects/dictnotes.txt

As for difference to the D impl.:
The decision logic for table resizing is a bit different (Python uses a 
load factor of 2/3 and table doubling for more as 50K entries, *4 else).
Python also wraps everything in Objects and attaches the hash when 
computed.


As for your modifications to the PyDict code:
Why have you changed the length() implementation?
As far as I remember, it's wrong to just return "used".


Also, can you add your timing to the aa project homepage?



More information about the Digitalmars-d mailing list