[Python-Dev] dictnotes.txt out of date?

Eli Bendersky eliben at gmail.com
Wed Jun 13 09:43:04 CEST 2012


Hi pydev,

I was looking at the memory allocation strategy of dict, out of
curiosity, and noted that Objects/dictnotes.txt is out of date as far
as the parameters go. It says about PyDict_STARTSIZE:

----
* PyDict_STARTSIZE. Starting size of dict (unless an instance dict).
    Currently set to 8. Must be a power of two.
    New dicts have to zero-out every cell.
    Increasing improves the sparseness of small dictionaries but costs
    time to read in the additional cache lines if they are not already
    in cache. That case is common when keyword arguments are passed.
    Prior to version 3.3, PyDict_MINSIZE was used as the starting size
    of a new dict.
-----

Although it mentions 3.3, I find no reference to PyDict_STARTSIZE in
the code anywhere.
Also it mentions PyDict_MINSIZE, which doesn't exist any more - having
been replaced by Py_DICT_MINZISE_SPLIT and Py_DICT_COMBINED.

I don't know what else is out of date, just looked at those and they
were. Maybe it would make sense to kill dictnotes.txt, folding some of
its more important contents in to comments in dictobject.c, since the
latter has a higher chance of being maintained along with code
changes?

Eli


More information about the Python-Dev mailing list