[Python-Dev] Dictionary sparseness (original) (raw)

Raymond Hettinger python@rcn.com
Mon, 5 May 2003 14:12:53 -0400


the best thing a user can do is rebuild the dict from scratch, inserting keys by decreasing order of access frequency.

Then a periodic resize comes alongm re-inserting everything in a different order.

The size of the dict can be forced larger by inserting artificial keys, if a user is insane .

Uh oh: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/198157

You'd have to be nuts, though

That explains alot ;)

Does the *4 patch (amended to have an upper bound) have a chance? It's automatic, simple, benefits some cases while not harming others,

Raymond