[issue14744] Use _PyUnicodeWriter API in str.format() internals

Antoine Pitrou report at bugs.python.org
Wed May 9 07:38:24 CEST 2012


Antoine Pitrou <pitrou at free.fr> added the comment:

> According to my benchmark (see below), formating a small number (5
> decimal digits) is 17% faster with my patch version 2 compared to tip,
> and 38% faster compared to Python 3.3 before my optimizations on str%
> tuples or str.format(). Creating a temporary PyUnicode is not cheap,
> at least for short strings.

A 17% improvement on a micro-benchmark is not much. There will probably
be no visible difference in real-world code.

Also, if creating temporary PyUnicodes is not cheap, perhaps we could
have a freelist for them?

----------

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


More information about the Python-bugs-list mailing list