]> granicus.if.org Git - python/commit
Optimization of str.format() for cases with unicode, long, and float
authorEric Smith <eric@trueblade.com>
Sat, 31 May 2008 01:40:08 +0000 (01:40 +0000)
committerEric Smith <eric@trueblade.com>
Sat, 31 May 2008 01:40:08 +0000 (01:40 +0000)
commit1d138f1c1a37a630099b629cf42c0bbe46d1344b
tree87b3d6cd5844fb390ecfce7851589687bf757ea8
parentfc8dca27d330f0c7c47713d2557f190c517c170e
Optimization of str.format() for cases with unicode, long, and float
arguments.  This gives about 30% speed improvement for the simplest
(but most common) cases.  This patch skips the __format__ dispatch, and
also avoids creating an object to hold the format_spec.

Unfortunately, backporting this to 2.6 is going to be more challenging
due to str/unicode issues with format_spec.  I'll work on that next.

Then I'll spend some time profiling and see what that tells me.
Objects/stringlib/string_format.h