Fastest technique for string concatenation

python at bdurham.com python at bdurham.com
Sat Oct 2 23:33:54 CEST 2010


Carey,

> Have you profiled an application and found string concatenation to be a performance bottleneck? I would be surprised, but it's always possible. 

The "application" is very simple - its essentially a finite state
machine that parses complex RTF files. We read char by char and do lots
of string concatenation as we move through our various states. Using
lists for concatenation and Emile's technique of eliminating repeated
attribute lookups, we have significantly improved the performance of our
utilities.

Malcolm



More information about the Python-list mailing list