[Python-Dev] optimization required: .format() is much slower than %

Antoine Pitrou solipsis at pitrou.net
Mon Aug 18 16:48:08 CEST 2008


Eric Smith <eric <at> trueblade.com> writes:
> 
> I finally backported this to 2.6 in r65814.  There's a similar 30% 
> speedup for the simplest cases.  Unicode optimization is worse than 
> string optimization, because of the way int, long, and float formatters 
> work.  This can be fixed, but I'm not sure the gain justifies the 
> effort.  I doubt I'll have time to look into this before beta3.

Given the choice, I would think it's more important to further speedup the 
implementation in 3.0 rather than try to backport the existing speedups to 2.6.
In 2.6 the standard formatting facility is still the % operator.

(Just my two suboptimal cents)





More information about the Python-Dev mailing list