(Sorry, I got a little CTRL-Enter happy and sent before I was ready...)

Building up strings in cfsavecontent also concatenates to the result
variable so the problem is the same.

=============================

Hmm, I don't think you are correct Brian.  I just whipped up a test of
string concatenation.  

Please spare the "proper load test" flames.  This is NOT a load test--
it is intended to make a process run long enough to capture a thread
stack.   Actually, in the context of large file generations I would call
it quite appropriate.

Concatenation "Hello World. " together 30 thousand times on CF 7.0.2 Ent
(Win) shows a vast difference between using & and simply outputting it
inside a cfsavecontent.

The & definitely spent all its time doing a Java.lang.String.concat().
The cfsavecontent not only executed 211 times faster, I didn't see a
single String.contat() happening.

Here are the results:
string & string: 17093ms 
String Length: 390000 

cfsavecontent: 125ms 
String Length: 390000

And here is the code:


<cfset string1 = "">
<cftimer label="string & string" type="outline">
        <cfloop from="1" to="30000" index="i">
                <cfset string1 = string1 & "Hello World. ">     
        </cfloop>
 </cftimer>
<cfoutput>String Length: #len(string1)#</cfoutput>


<cfsetting enablecfoutputonly="true">
<cftimer label="cfsavecontent" type="outline">
        <cfsavecontent variable="string2">
                <cfloop from="1" to="30000" index="i">
                        <cfoutput>Hello World.</cfoutput>       
                </cfloop>
        </cfsavecontent>
 </cftimer>
<cfsetting enablecfoutputonly="false">
<cfoutput>String Length: #len(string2)#</cfoutput>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306789
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to