[Tutor] Which is really faster - concatenation or join?

Marilyn Davis marilyn at deliberate.com
Sat Aug 28 02:07:01 CEST 2004


Thank you for this Kent.  This is very interesting for sure.

But maybe I'm misunderstanding your interpretation of the data?

I'm selecting some key data -- assuming I understand what you did:

> Unit length is 1
>         tPlus  tJoin     total chars

>    450  0.262  0.264     450
>    500  0.307  0.292     500

> Unit length is 2
>         tPlus  tJoin

>    200  0.114  0.125     400
>    250  0.155  0.154     500

> Unit length is 3
>         tPlus  tJoin

>    150  0.090  0.095     450
>    200  0.134  0.127     600

> Unit length is 4
>         tPlus  tJoin

>    100  0.057  0.063     400
>    150  0.101  0.096     600


> Unit length is 5
>         tPlus  tJoin

>    100  0.063  0.064     500
>    150  0.114  0.097     650

It looks to me as if the number of operations isn't as relevant as the
total number of characters in the finished string, and perhaps, when the
total number is about 500 or less, you're better off with the tPlus.

Interesting data.  Thanks again.

Marilyn Davis




More information about the Tutor mailing list