Popular recipes tagged "compact" but not "data"http://code.activestate.com/recipes/tags/compact-data/2013-01-17T09:28:24-08:00ActiveState Code RecipesProof-of-concept for a more space-efficient, faster-looping dictionary (Python)
2013-01-17T09:28:24-08:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/578375-proof-of-concept-for-a-more-space-efficient-faster/
<p style="color: grey">
Python
recipe 578375
by <a href="/recipes/users/178123/">Raymond Hettinger</a>
(<a href="/recipes/tags/compact/">compact</a>, <a href="/recipes/tags/dictionary/">dictionary</a>).
Revision 20.
</p>
<p>Save space and improve iteration speed by moving the hash/key/value entries to a densely packed array keeping only a sparse array of indices. This eliminates wasted space without requiring any algorithmic changes.</p>