]> granicus.if.org Git - python/commit
Fix massive slowdown in string formatting with str.format.
authorAntoine Pitrou <solipsis@pitrou.net>
Fri, 7 Oct 2011 00:26:47 +0000 (02:26 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Fri, 7 Oct 2011 00:26:47 +0000 (02:26 +0200)
commit4574e62c6e0f52369a67ffae0984004f9aac2ba5
treee749723496031a66fe2749149dd2f29b3f40a9ec
parent5c0ba36d5ff8d7693c5014b8696e2fab7468afd4
Fix massive slowdown in string formatting with str.format.

Example:
./python -m timeit -s "f='{}' + '-' * 1024 + '{}'; s='abcd' * 16384" "f.format(s, s)"

-> before: 547 usec per loop
-> after: 13 usec per loop
-> 3.2: 22.5 usec per loop
-> 2.7: 12.6 usec per loop
Objects/stringlib/unicode_format.h