[issue45340] Lazily create dictionaries for plain Python objects

Mark Shannon report at bugs.python.org
Tue Oct 12 10:35:58 EDT 2021


Mark Shannon <mark at hotpy.org> added the comment:

Josh,

I'm not really following the details of what you are saying.

You claim "Key-sharing dictionaries were accepted largely without question because they didn't harm code that broke them".
Is that true? I don't remember it that way. They were accepted because they saved memory and didn't slow things down.

This issue, proposes the same thing: less memory used, no slower or a bit faster.

If you are curious about how the first few instances of a class are handled, it is described here: 
https://github.com/faster-cpython/ideas/issues/72#issuecomment-920117600

Lazy attribute is not an issue here. How well keys are shared across instances depends on the dictionary implementation and was improved by https://github.com/python/cpython/pull/28520


It would be helpful if you could give specific examples where you think this change would use more memory or be slower.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45340>
_______________________________________


More information about the Python-bugs-list mailing list