string.join() vs % and + operators

Al Christians achrist at easystreet.com
Fri Apr 2 19:50:09 EST 1999


Aahz Maruch wrote:
> 
> Yup.  Using '+' for strings really bites when you've got long (or
> potentially long) strings.  The average size of the string you're
> concatenating is about a hundred characters; suppose you're doing CGI
> work with redirects, and you're looking at closer to three hundred
> characters a pop.
> 
> Try adding a 1K pre-string to the front of each of your Ways and see
> what happens to the speed.

Time went up from 69 secondes to 115.  So it takes only a little bit
longer to join the strings than it does to skip over 1k exach time.

Al




More information about the Python-list mailing list