Hi Andrew, just change "some text" to something about 10 times larger and change the 500 to maybe 5000 and then you'll find out how fast string buffer is in comparison to CFMX strings...
Gert Greetings / GrĂ¼sse Gert Franz Customer Care [EMAIL PROTECTED] www.railo.ch Join our Mailing List / Treten Sie unserer Mailingliste bei: deutsch: http://de.groups.yahoo.com/group/railo/ english: http://groups.yahoo.com/group/railo_talk/ Andrew Grosset schrieb: > 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:250274 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

