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 <rep...@bugs.python.org>
<http://bugs.python.org/issue19581>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to