On Oct 3, 8:19 am, Roy Smith r...@panix.com 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 is the fastest technique for string
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
There is a fourth technique, and that is to avoid concatenation
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
- string 'addition' (s = s + char
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 true?
The 3 string
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 code
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 )
On Sat, Oct 2, 2010 at 12:09 PM, 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?
Have you profiled an application and found string concatenation to be
a performance
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
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
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
10 matches
Mail list logo