Ok, so in Java using a String can cost a lot when you have to append over
and over (because I think it makes a new String object for each iteration) -
to fix this you're supposed to use a string buffer. So I decided to try
using a string buffer in MX to see if I could get a bit of a performance
gain... check it out

with string buffer:
<cfscript>
        sb_filler = createObject("java","java.lang.StringBuffer");

        for(x=0; x lte 65535; x=x+1){
                sb_filler.append(chr(x));
        }
</cfscript>
<cfoutput>#sb_filler.toString()#</cfoutput>

** Average: 5609 ms **


normal string
<cfscript>
        s_filler = "";

        for(x=0; x lte 65535; x=x+1){
                s_filler = s_filler & chr(x);
        }

</cfscript>
<cfoutput>#s_filler#</cfoutput>

** Average: 17250 ms **

You wont see a bit performance in crease with little appends, but it makes a
difference with big ones.


(I can believe Macromedia doesn't want me to work for them :-/ jezzz)
Rob

http://treebeard.sourceforge.net
http://ruinworld.sourceforge.net
Scientia Est Potentia

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Reply via email to