[Python-Dev] Reducing memory overhead for dictionaries by removing me_hash

Kirat Singh kirat.singh at gmail.com
Tue Apr 25 02:20:15 CEST 2006


very true, but python makes it oh so easy to be lazy :-)

On 4/24/06, Guido van Rossum <guido at python.org> wrote:
>
> On 4/23/06, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> > Kirat Singh wrote:
> > > The reason I looked into this to begin with was that my code used up a
> > > bunch of memory which was traceable to lots of little objects with
> > > instance dicts, so it seemed that if instancedicts took less memory I
> > > wouldn't have to go and add __slots__ to a bunch of my classes, or
> > > rewrite things as tuples/lists, etc.
> >
> > Ah. In that case, I would be curious if tuning PyDict_MINSIZE could
> > help. If you have many objects of the same type, am I right assuming
> > they all have the same number of dictionary keys? If so, what is the
> > dictionary size? Do they use ma_smalltable, or do they have an extra
> > ma_table?
>
> But the space savings by using __slots__ is so much bigger! (And less
> work than hacking the C code too. :-)
>
> --
> --Guido van Rossum (home page: http://www.python.org/~guido/)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060424/9f4ccddf/attachment.htm 


More information about the Python-Dev mailing list