House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home / Groups / ColdFusion Talk (CF-Talk)

Passing ColdFusion Arrays By Reference

Author:
Tom Kitta
09/19/2006 10:45 AM

I just run the following test: <cfset javaArray = CreateObject("java", "java.util.ArrayList").Init()/> <cfset regArray = arrayNew(1)> <cfset arrayResize(regArray,100000)> <!--- <cfset arrayResize(javaArray,100000)> ---> <cftimer label="Test Java Array" type="outline">   <cfloop index="m" from="1" to="100000" step="1">     <cfset javaArray[m] = m>   </cfloop> </cftimer> <cftimer label="Test ColdFusion Array" type="outline">   <cfloop index="k" from="1" to="100000" step="1">     <cfset regArray[k] = k>   </cfloop> </cftimer> And a) CF array runs faster due to the benefits of the resize (otherwise the run time is similar) b) your version of the array is not supported by the resize, so your array is not 100% like regular CF array with additional benefit of passing by reference. One would now have to check a lot more about your array version to figure out what it supports and what it doesn't support. TK http://www.tomkitta.com Sometimes I find it makes the code run faster ;) ....................... Ben Nadel www.bennadel.com Certified Advanced ColdFusion Developer Need Help? www.bennadel.com/ask-ben/


Search cf-talk

February 11, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29