Re: Append or concatenate to each element in sequence

new topic     » goto parent     » topic index » view thread      » older message » newer message

I did more analysis on my data. I will need to use
both concatenation and appending.

I did some benchmark testing. The two fastest
routines are shown below. An interesting result is
that seqAppend() is a tiny bit faster than seqConcat().
For single character appends/concats they produce
the same results. For string appends/concat I will
have to select which one to use.

A note: my testing was only for short sequences like
the one in the code below.

I am posting this just FYI.


s0 = {"abc","def","ghi","jkl"}

function seqConcat(sequence srcSeq, object toConcat)
   for i = 1 to length(srcSeq) do
     srcSeq[i] &= toConcat
   end for
   return srcSeq
end function  --seqConcat()

function seqAppend(sequence srcSeq, object toAppend)
   for i = 1 to length(srcSeq) do
     srcSeq[i] = append(srcSeq[i], toAppend)
   end for
   return srcSeq
end function  --seqConcat()

s4 = seqAppend(s0, '\n')
s1 = seqConcat(s0, '\n')



Terry Constant

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu