[Python-Dev] A new dict for Xmas?

"Martin v. Löwis" martin at v.loewis.de
Thu Dec 22 15:09:25 CET 2011

> The current dict implementation is getting pretty old,
> isn't it time we had a new one (for xmas)?

I like the approach, and I think something should be done indeed.
If you don't contribute your approach, I'd like to drop at least
ma_smalltable for 3.3.

A number of things about your branch came to my mind:
- it would be useful to have a specialized representation for
  all-keys-are-strings. In that case, me_hash could be dropped
  from the representation. You would get savings compared to
  the status quo even in the non-shared case.
- why does _dictkeys need to be a full-blown Python object?
  We need refcounting and the size, but not the type slot.
- I wonder whether the shared keys could be computed at compile
  time, considering all attribute names that get assigned for
  self. The compiler could list those in the code object, and
  class creation could iterate over all methods (taking base
  classes into account).


More information about the Python-Dev mailing list