[Tutor] String concatenation too slow

Shrutarshi Basu technorapture at gmail.com
Tue Jul 1 07:12:21 CEST 2008


I'm working on a program to create Lindenmayer systems. These systems
depend on heavy string rewriting to form complex patterns.I've been
using string concatenation to read through the string, and then create
the new one based on a dictionary lookup. However it becomes very slow
once the string gets very long (several thousand characters). Part of
it is undoubtedly due to the fact that the algorithm is quadratic (i'm
trying to find a better way) but I was wondering if there might be a
faster alternative to string concatenation. Would appending to a list
of strings be faster? I'm going to be doing thousands of these
appends, so even a small boost would be helpful.
Thanks,
Basu

-- 
The ByteBaker :
http://www.bytebaker.com


More information about the Tutor mailing list