PATCH: Speed up direct string concatenation by 20+%!
Fredrik Lundh
fredrik at pythonware.com
Fri Sep 29 11:04:06 EDT 2006
Larry Hastings wrote:
>> Nice idea, though. You might also see how it does on tasks like
>>
>> s = ""
>> for i in range(100000):
>> s += "a"
>
> Sure. Here are the results, but with range (10000000):
ten million? what hardware are you running this on?
> Python 2.5 release: 31.0s
> Python 2.5 locally built: 30.7s
> Python 2.5 concat: 4.4s
> % Improvement: *697%*!
>
> Woah! Thanks for suggesting a benchmark where it really shines :)
what's in "s" when that loop is done?
</F>
More information about the Python-list
mailing list