Efficient string concatenation methods

Roel Schroeven rschroev_nospam_ml at fastmail.fm
Sun May 2 06:38:36 EDT 2004


Oliver Crow wrote:

> I'd be happy to hear if anyone else has done similar tests and if
> there are any other good candidate methods that I missed.

I'd like to try out another variant, but I'm unable to run your 
script... Where does that timing module come from? I can't find it anywhere.

The method I propose is simply

def method7():
     return ''.join(map(str, xrange(loop_count)))

I ran my own little test and it seems to be faster than method6, but I'd 
like to run it in your script for more reliable results. Also, I haven't 
done any memory measurement, only a timing.

-- 
"Codito ergo sum"
Roel Schroeven



More information about the Python-list mailing list