[issue19646] Use PyUnicodeWriter in repr(dict)

STINNER Victor report at bugs.python.org
Tue Nov 19 14:21:33 CET 2013


STINNER Victor added the comment:

> I'm surprised that this has given such large effect. ;) I hoped only on more clear code.

To be honest, I expected shorter code but worse performances using _PyUnicodeWriter_WriteASCIIString().

dict_repr() was not really super fast: it did call PyUnicode_FromString() at each call to decode ": " and ", " from UTF-8. list_repr() and tuplerepr() kept ", " separator cached in a static variable. This is probably why the code is now faster.

----------

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


More information about the Python-bugs-list mailing list