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

Raymond,

Only split dicts need the extra field.

Classes where many instances do not have exactly the same set of attributes may 
be more common than you think.
There are many reasons why some attributes may be added conditionally.

PR 28520 actually makes the dictionary code a bit simpler, as we don't need to 
maintain the invariant that value arrays cannot have holes. Maintaining an 
order is simple and cheap:

order = (order<<4) | insertion_index

There are pros and cons to both schemes: PR 28520 and the current 
implementation.

The problem with the current scheme is that it only works well for classes 
where all instances are initialized with exactly the same attributes, and in 
the same order.

The PR 28520 scheme can handle those cases where order and key set differ a 
bit, but has a maximum size of 16 before the dict must be combined.


We need as many instances as possible to have split dictionaries, to get 
https://github.com/faster-cpython/ideas/issues/72 working well as it will make 
the cost of not sharing even greater, relatively.

----------

_______________________________________
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