Tom,

Excellent catch. I did not think to test the ArrayResize() method. 

Hmmm, that may hinder the use a lot, for the very reason you are saying. I
don't want people to have to test for type.

Dang!  

.......................
Ben Nadel 
www.bennadel.com
Certified Advanced ColdFusion Developer

Need Help?
www.bennadel.com/ask-ben/


-----Original Message-----
From: Tom Kitta [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 19, 2006 10:44 AM
To: CF-Talk
Subject: RE: Passing ColdFusion Arrays By Reference

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

-----Original Message-----
From: Ben Nadel [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 19, 2006 9:26 AM
To: CF-Talk
Subject: RE: Passing ColdFusion Arrays By Reference


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/




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:253517
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to