STINNER Victor added the comment: > If you see a factor of 30x difference in your code, I suspect it's not > related to str.format(), but some other processing in your code.
The performance of instructions like ("x=%s" % x) or ("x={}".format(x)) depend on the length of the string. Maybe poostenr has some very long strings? -- Closed issues related to _PyUnicodeWriter API: * issue #14716: Use unicode_writer API for str.format() * issue #14687: Optimize str%tuple for the PEP 393 * issue #14744: Use _PyUnicodeWriter API in str.format() internals * issue #16147: Rewrite PyUnicode_FromFormatV() to use the _PyUnicodeWriter API * issue #17694: Enhance _PyUnicodeWriter API to control minimum buffer length without overallocation * issue #19513: Use PyUnicodeWriter instead of PyAccu in repr(tuple) and repr(list) * issue #19646: Use PyUnicodeWriter in repr(dict) I'm listing these issues because they contain microbenchmarks script if you would like to play with them. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26118> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com