Python speed-up

Gerrit gerrit at nl.linux.org
Wed Sep 22 21:57:41 CEST 2004


Skip Montanaro wrote:
>     gerrit> Why isn't cStringIO faster than concatenating strings?
> 
>     gerrit> Using python2.4:
>     ...
> 
> Because in 2.4 common case string concatenation gets a big speed boost:
> 
>     % python2.3 ~/local/bin/timeit.py  -s 's=""' "s+='foo'"
>     10000 loops, best of 3: 68.3 usec per loop
>     % python2.4 ~/local/bin/timeit.py  -s 's=""' "s+='foo'"
>     1000000 loops, best of 3: 0.855 usec per loop

Ah. Am I correct to conclude that StringIO should either be rewritten
concatenating strings, or be deprecated, or both?

Gerrit.

-- 
Weather in Twenthe, Netherlands 22/09 21:25:
	12.0°C   wind 4.5 m/s WSW (57 m above NAP)
-- 
Gerrit Holl - 2nd year student of Applied Physics, Twente University, NL.
Experiences with Asperger's Syndrome:
	EN http://topjaklont.student.utwente.nl/english/
	NL http://topjaklont.student.utwente.nl/



More information about the Python-list mailing list