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
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
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
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
>
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
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
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
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
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
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
10 matches
Mail list logo