Mark Shannon <m...@hotpy.org> added the comment:

This can be mitigated, if not entirely fixed, by storing an ordering bit vector 
in the values.

This way all instances of the class SometimesShared in the example above can 
share the keys.

The keys might be ("optional", "attr")

For any instances with only "attr" as an attibute, the values would be (NULL, 
value) and the order would be (1,)

The downsides of this approach are:
1. Each values, and thus dict needs an extra 64 bit value.
2. Shared keys have a maximum size of 16.

Overall, I expect the improved sharing to more than compensate for the 
disadvantages.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40116>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to