This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Mark.Shannon
Recipients Mark.Shannon, lemburg, methane, rhettinger, serhiy.storchaka
Date 2021-09-23.12:24:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1632399878.0.0.242282672878.issue40116@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-09-23 12:24:38Mark.Shannonsetrecipients: + Mark.Shannon, lemburg, rhettinger, methane, serhiy.storchaka
2021-09-23 12:24:38Mark.Shannonsetmessageid: <1632399878.0.0.242282672878.issue40116@roundup.psfhosted.org>
2021-09-23 12:24:37Mark.Shannonlinkissue40116 messages
2021-09-23 12:24:37Mark.Shannoncreate