Re: Fastest technique for string concatenation

2010-10-05 Thread Will Hall
ing to a list and then joining > > > this list when done is the fastest technique for string > > > concatenation. Is this true? > > > > The 3 string concatenation techniques I can think of are: > > > > - append to list, join > > > - stri

Re: Fastest technique for string concatenation

2010-10-05 Thread Will Hall
On Oct 3, 8:19 am, Roy Smith wrote: > My local news feed seems to have lost the early part of this thread, so > I'm afraid I don't know who I'm quoting here: > > > My understanding is that appending to a list and then joining > > this list when done

Re: Fastest technique for string concatenation

2010-10-03 Thread Roy Smith
My local news feed seems to have lost the early part of this thread, so I'm afraid I don't know who I'm quoting here: > My understanding is that appending to a list and then joining > this list when done is the fastest technique for string > concatenation. Is this

Re: Fastest technique for string concatenation

2010-10-03 Thread Peter Otten
pyt...@bdurham.com wrote: > My understanding is that appending to a list and then joining > this list when done is the fastest technique for string > concatenation. Is this true? > > The 3 string concatenation techniques I can think of are: > > - append to list, join >

Re: Fastest technique for string concatenation

2010-10-02 Thread Steven D'Aprano
On Sat, 02 Oct 2010 13:17:02 -0700, Carey Tilden wrote: > Have you profiled an application and found string concatenation to be > a performance bottleneck?  I would be surprised, but it's always > possible.  If not, I'd suggest you choose the technique that is most > clear and concise, and worry a

Re: Fastest technique for string concatenation

2010-10-02 Thread python
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

Re: Fastest technique for string concatenation

2010-10-02 Thread python
Emile, > Your times will improve when not burdened by the repeated method lookups and > element-wise list creation. Excellent point!! Here's updated timings for each technique followed by copy and paste source code for anyone that wants to fiddle with these tests. I've placed your name above yo

Re: Fastest technique for string concatenation

2010-10-02 Thread Carey Tilden
On Sat, Oct 2, 2010 at 12:09 PM, wrote: > My understanding is that appending to a list and then joining this list when > done is the fastest technique for string concatenation. Is this true? Have you profiled an application and found string concatenation to be a performance bottlene

Re: Fastest technique for string concatenation

2010-10-02 Thread Emile van Sebille
On 10/2/2010 12:09 PM pyt...@bdurham.com said... Your times will improve when not burdened by the repeated method lookups and element-wise list creation: try with eg, def testListAppend2(): output = list() append = output.append for char in source: append( char ) outpu

Fastest technique for string concatenation

2010-10-02 Thread python
My understanding is that appending to a list and then joining this list when done is the fastest technique for string concatenation. Is this true? The 3 string concatenation techniques I can think of are: - append to list, join - string 'addition' (s = s + char) - cStringIO The