[Python-Dev] Optimization of the Year
Raymond Hettinger
python at rcn.com
Wed Feb 11 11:35:12 EST 2004
[GvR]
> I disagree with making the hack of setting list->allocated = -1 an
> official part of the list object API.
Okay.
> Since you have ignored repeated requests for real-life examples of
> code that messes with ob_item outside the core,
Haven't found any. Initially, I thought there were because the guard
was getting tripped. Now, it looks like Hye-Shik's NULL check is
sufficient.
> let's keep the
> 'allocated' field an internal detail of the list implementation.
Yes.
> Then
> I can ignore the other posts about binary (in)compatibility too. :-)
Right.
[Armin]
> BUT there is something that the patch does wrong: it never reclaims
memory
> from the list, unlike the NRESIZE trick which used to realloc with a
> smaller
> size occasionally.
Yes. I had already caught that and sent in a change to Hye-Shik to make
sure downward resizing can happen. Also, I'll incorporate the minor
fixups you sent in. Any further adventures should probably be done as a
separate patch (don't change too many things at once).
Raymond
More information about the Python-Dev
mailing list