[Python-3000] PyUnicodeObject implementation

Jeremy Kloth jeremy.kloth at gmail.com
Sat Sep 6 03:54:42 CEST 2008


I don't know if this is too late to do before the final release, but shouldn't 
the implementation of PyUnicodeObject be updated to match the much more 
efficient old PyStringObject layout?  I mean eliminating the double malloc 
that is currently required for each unicode string.

PyStringObject is declared as a PyVarObject allocated in one chunk, whereas 
the current PyUnicodeObject is a PyObject allocated in two chunks, one for 
the object and one for the Py_UNICODE data.

I think that this change would go a long way towads making unicode strings 
comparable to old (2.x) string speeds. I can see that if not changed now, 
there would be 3rd party extensions that would be relying on the particular 
layout of PyUnicodeObject and therefore making changing it later too risky.

If there is interest in this change, I would happily write a patch that make 
this change.

Thanks,
Jeremy

-- 
Jeremy Kloth
http://4suite.org/


More information about the Python-3000 mailing list