STINNER Victor <victor.stin...@gmail.com> added the comment: >> When it's possible to not overallocate, the speed up is around 10% for >> short strings (I suppose that it's much better to longer strings). > Well, please post a benchmark for long strings, then :-)
Ok, here you have. I don't understand why results are so random. There is no performance regression, but there are interesting speed up. Original: 200 ns: L=10 ** 3; fmt="%s"; args="a" * L; fmt % args 370 ns: L=10 ** 4; fmt="%s"; args="a" * L; fmt % args 3.85 ms: L=10 ** 5; fmt="%s"; args="a" * L; fmt % args 334 ms: L=10 ** 6; fmt="%s"; args="a" * L; fmt % args 2.87 ms: L=10 ** 7; fmt="%s"; args="a" * L; fmt % args 23.9 ms: L=10 ** 8; fmt="%s"; args="a" * L; fmt % args Patched: 120 ns (-40%): L=10 ** 3; fmt="%s"; args="a" * L; fmt % args 276 ns (-25%): L=10 ** 4; fmt="%s"; args="a" * L; fmt % args 3.7 ms (-4%): L=10 ** 5; fmt="%s"; args="a" * L; fmt % args 67.6 ms (-80%): L=10 ** 6; fmt="%s"; args="a" * L; fmt % args 1.38 ms (-51%): L=10 ** 7; fmt="%s"; args="a" * L; fmt % args 23.5 ms (-2%): L=10 ** 8; fmt="%s"; args="a" * L; fmt % args ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14744> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com