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

Eli Bendersky eliben at gmail.com
Wed Jun 13 17:03:05 CEST 2012


>> 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.
>
>
> That's my fault. I didn't update dictnotes.txt when I changed
> PyDict_STARTSIZE to PyDict_MINSIZE_COMBINED.

Could you update it now?

>> 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?
>
>
> I think that the parts of dictnotes.txt that just duplicate comments in
> dictobject.c should be removed.
> However, I think it is worth keeping dictnotes.txt as it has historical
> information and results of previous experiments.

Personally I think that describing the customization #defines belongs
in the source, above the relevant #defines, rather than in a separate
file. No problem with leaving historical notes and misc ruminations in
the separate .txt file, though.

Eli


More information about the Python-Dev mailing list