[Python-Dev] Re: [Python-checkins]
python/dist/src/Python compile.c, 2.311, 2.312
"Martin v. Löwis"
martin at v.loewis.de
Tue Aug 3 19:12:44 CEST 2004
Michael Hudson wrote:
> Me neither. Are you sure you regenerated cookielib?
Oops, no. Or, rather, yes - even the first number is already
> What would it cost to check if all strings could be stored via
> TYPE_STRINGREF? (Almost nothing in code terms...)
It would cause additional dictionary lookups on marshalling, which
in turn would cause hash computation for all strings. Currently,
as only interned strings are marshalled through TYPE_STRINGREF,
we know that hash values are already computed for all of them,
so we only pay a dict lookup per string (and perhaps an allocation
if the string is new and the dict needs resizing).
In addition, there is a slight semantical change, in that equal
strings become shared on unmarshalling. I don't think this is relevant,
though, since marshal never worried about shared strings in the first
> I'd be happy with any other (I mentioned not doing
> refcounting on dictobject.c's dummy; maybe I should actually see if
> that's possible :-).
Feel free to change the marshalling to try sharing all strings;
it might be easier to revert the change to compile.c, though.
More information about the Python-Dev