[issue19581] PyUnicodeWriter: change the overallocation factor for Windows

STINNER Victor report at bugs.python.org
Thu Nov 14 16:31:41 CET 2013


STINNER Victor added the comment:

I chose 25% on Linux after some micro-benchmarks on str%args and str.format(args). If the buffer is too large, the final resize (because PyUnicodeObject must have the exact size) is slow. I suppose that realloc() can avoid copying data if the new is is very close, but has to allocate a new memory block and copy data if the new size is higher than a threshold. It's how _PyObject_Realloc() for example.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19581>
_______________________________________


More information about the Python-bugs-list mailing list