Ben, when would you use "java.lang.StringBuffer" as compared to <cfset a = ""> <cfloop index="i" from="1" to="500"> <cfset a = a & "some text"> </cfloop>
I found the above method faster. Andrew. >When doing a lot of string concatenation, you should totally use the Java >string buffer: > ><cfset jsbOutput = CreateObject( "java", "java.lang.StringBuffer" ).Init() >/> > ><cfset jsbOutput.Append( "some text" ) /> ><cfset jsbOutput.Append( "some text" ) /> ><cfset jsbOutput.Append( "some text" ) /> ><cfset jsbOutput.Append( "some text" ) /> ><cfset jsbOutput.Append( "some text" ) /> > ><cffile.... Output="#jsbOutput.ToString()#" /> > > >To only does the concatentation once at the end via the ToString() method. >This will make it blazing fast. > >This should replace anywhere you build the output for the file. > >...................... >Ben Nadel >www.bennadel.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250255 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4