htg,
What hardware and OS are you testing on? I moved the object open
outside of the for loop for both tests to reduce the effect of
swizzling and unswizzling. I am now using the same object in every
concatenation operation. The numbers are much worse on a Macintosh:
Cache for UNIX (Apple Mac OS X for x86) 2008.2.1 (Build 902_0_7983U)
Mon Mar 30 2009 11:20:30 EDT
Method 1 time elapsed=96.45261
Method 1 time elapsed=96.134513
Method 1 time elapsed=97.038279
Method 2 time elapsed=.466633
Method 2 time elapsed=.488978
Method 2 time elapsed=.469039
Cache for UNIX (Apple Mac OS X for x86-64) 2009.1 (Build 401U) Sun Apr
12 2009 17:24:54 EDT
Method 1 time elapsed=53.520875
Method 1 time elapsed=53.614933
Method 1 time elapsed=54.044207
Method 2 time elapsed=.086315
Method 2 time elapsed=.084336
Method 2 time elapsed=.106758
We don't depend on the Macintosh for deployment, but I use it for a
development environment. My numbers are drastically different than
yours and I wonder if this might be attributed to either a difference
in hardware, or OS. I have noticed before that string intensive
routines are often much slower on a Macintosh server than with a
similar processor on Windows XP.