Python speed-up

Alex Martelli aleaxit at yahoo.com
Wed Sep 22 21:57:01 CEST 2004


Gerrit <gerrit at nl.linux.org> wrote:
   ...
> Why isn't cStringIO faster than concatenating strings?
> 
> Using python2.4:

Python 2.4 did reduce the cost of the bigstring+=littlepiece trap.  But
I do agree there's nevertheless something strange here.  cStringIO is
using a very different strategy, a buffer that doubles and gets
realloc'd every time it would fill up -- maybe that's tripping up its
performance...?


Alex



More information about the Python-list mailing list