Author rhettinger
Recipients inada.naoki, josh.r, louielu, r.david.murray, rhettinger, serhiy.storchaka, tim.peters, xiang.zhang
Date 2019-03-12.15:26:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1552404402.35.0.752334075472.issue30040@roundup.psfhosted.org>
In-reply-to
Content
I don't think this should have been done.  Conceptually, there is no basis for presuming key-sharing for new empty dicts -- you can't know what they would share with.  This patch essentially undoes the entire reason for having a pre-allocated minsize dict.  If it were deemed to be the norm that applications typically had huge numbers of empty dicts that were never populated, then the correct solution would be a NULL pointer to the table field (as dicts do).

FWIW, the macro benchmarks aren't very informative here because they don't exercise much of this code.  I think there is an over-prioritization of small space savings at the expense of the intended use cases for dicts.  This patch just forces every dict that gets used to have to convert back from a key-sharing dict and do a memory allocation and memset(0) in the process.  The whole point of the minsize dict was to avoid that cost in the common case of small dicts (i.e. passing keyword arguments).
History
Date User Action Args
2019-03-12 15:26:42rhettingersetrecipients: + rhettinger, tim.peters, r.david.murray, inada.naoki, serhiy.storchaka, josh.r, xiang.zhang, louielu
2019-03-12 15:26:42rhettingersetmessageid: <1552404402.35.0.752334075472.issue30040@roundup.psfhosted.org>
2019-03-12 15:26:42rhettingerlinkissue30040 messages
2019-03-12 15:26:42rhettingercreate