Ok, here are my memory usage stats on CF 7.  Someone please correct me
if my code is wrong. It's a little messy, and I apologize for that.

Memory Before: 83 Megs
string & string: 52795ms 
String Length: 650000
Memory After: 101 Megs -- Increase of 17 Megs

Memory Before: 85 Megs
cfsavecontent: 172ms 
String Length: 650000
Memory After: 97 Megs -- Increase of 12 Megs

As you can see, cfsavecontent used about 1/3 less memory that the other
method.  Not nearly as proportional savings the execution time...

Wow-- here are the numbers from my CF8 box:

Memory Before: 161 Megs
string & string: 26530ms 
String Length: 650000
Memory After: 195 Megs -- Increase of 35 Megs

Memory Before: 158 Megs
cfsavecontent: 47ms 
String Length: 650000
Memory After: 165 Megs -- Increase of 7 Megs

This time the cfsavecontent used 4/5ths less memory!

Very interesting indeed...  Of course, please understand there are many
factors and JVM settings that go into this.  I'm not trying to claim
everyone else will get results like this.

Here the latest version of my (slightly sloppy) code:



<cfset runtime = CreateObject("java", "java.lang.Runtime").getRuntime()>
<cfset total_memory = runtime.totalMemory()>

<cfset runtime.gc()>

<cfset memory_before = (total_memory-runtime.freeMemory()) / 1024 /
1024>
<cfoutput>Memory Before: #round(memory_before)# Megs<br>
<cfset string1 = "">
<cftimer label="string & string" type="outline">
        <cfloop from="1" to="50000" index="i">
                <cfset string1 = string1 & "Hello World. ">     
        </cfloop>
 </cftimer>
<cfoutput>String Length: #len(string1)#</cfoutput><br>
<cfset memory_after = (total_memory-runtime.freeMemory()) / 1024 / 1024>
Memory After: #round(memory_after)# Megs -- Increase of
#round(memory_after - memory_before)# Megs<br>
<br />
</cfoutput>

<cfset runtime.gc()>

<cfset memory_before = (total_memory-runtime.freeMemory()) / 1024 /
1024>
<cfoutput>Memory Before: #round(memory_before)# Megs<br></cfoutput>
<cfsetting enablecfoutputonly="true">
<cftimer label="cfsavecontent" type="outline">
        <cfsavecontent variable="string2">
                <cfloop from="1" to="50000" index="i">
                        <cfoutput>Hello World.</cfoutput>       
                </cfloop>
        </cfsavecontent>
 </cftimer>
<cfsetting enablecfoutputonly="false">
<cfoutput>String Length: #len(string2)#</cfoutput><br>
<cfset memory_after = (total_memory-runtime.freeMemory()) / 1024 / 1024>
<cfoutput>Memory After: #round(memory_after)# Megs -- Increase of
#round(memory_after - memory_before)# Megs<br></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:306715
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