[issue19646] Use PyUnicodeWriter in repr(dict)

2013-11-19 Thread STINNER Victor
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_F

[issue19646] Use PyUnicodeWriter in repr(dict)

2013-11-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Using this function, there is no need to create temporary colon (": ") or sep > (", ") strings, performances are a little better with the final commit. I'm surprised that this has given such large effect. ;) I hoped only on more clear code. -- __

[issue19646] Use PyUnicodeWriter in repr(dict)

2013-11-19 Thread STINNER Victor
Changes by STINNER Victor : -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue19646] Use PyUnicodeWriter in repr(dict)

2013-11-19 Thread STINNER Victor
STINNER Victor added the comment: I added a new _PyUnicodeWriter_WriteASCIIString() function to reply to Serhiy's comment on Rietveld: "Perhaps it will be worth to add a helper function or macros _PyUnicodeWriter_WriteTwoAsciiChars()?" changeset: 87263:d1ca05428c38 user:Victor Stinn

[issue19646] Use PyUnicodeWriter in repr(dict)

2013-11-19 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3a354b879d1f by Victor Stinner in branch 'default': Issue #19646: repr(dict) now uses _PyUnicodeWriter API for better performances http://hg.python.org/cpython/rev/3a354b879d1f -- nosy: +python-dev ___ Py

[issue19646] Use PyUnicodeWriter in repr(dict)

2013-11-18 Thread STINNER Victor
Changes by STINNER Victor : Added file: http://bugs.python.org/file32695/bench_dict_repr.py ___ Python tracker ___ ___ Python-bugs-list mailin

[issue19646] Use PyUnicodeWriter in repr(dict)

2013-11-18 Thread STINNER Victor
New submission from STINNER Victor: Attached patch modify dict_repr() function to use the _PyUnicodeWriter API instead of building a list of short strings with PyUnicode_AppendAndDel() and calling PyUnicode_Join() at the end to join the list. PyUnicode_Append() is inefficient because it has to