[Python-Dev] cpython: Implement PEP 412: Key-sharing dictionaries (closes #13903)

martin at v.loewis.de martin at v.loewis.de
Tue Apr 24 19:43:30 CEST 2012

> Benchmarks should measure memory usage too, of course.  Sadly that  
> is not possible in standard cPython.

It's actually very easy in standard CPython, using sys.getsizeof.

> Btw, this is of great interest to me at the moment, our Shanghai  
> engineers are screaming at the
> memory waste incurred by dictionaries.  A 10 item dictionary  
> consumes 1/2k on 32 bits, did you know this?

I did.

In Python 3.3, this now goes down to 248 bytes (32 bits).


More information about the Python-Dev mailing list