> well, I am actually passing the IDS to a delete-function (which has  
> the ID as parameter) This delete-function has one objectid as a  
> parameter and then does several checks and delete queries in  
> different tables. I simplified it a bit to make my question become  
> more clear.

Ah. I see. Apples to oranges for my suggestion then.

> I also thought that looping over an array was much faster than  
> looping over a list, so I chose the array for performance reasons  
> as it should contain several thousands of records. But maybe  
> somebody just gave me a bad tip ;-)

For Coldfusion to loop the list, possibly, for the DBMS to handle the  
list, likely not.  When you pass the list in the query directly as a  
value, the DBMS does the heavy lifting for you instead CF having to  
evaluate each iteration of the loop.   That's where you would see a  
performance boost .

Not exactly scientific, but if you try the following code, looping  
the list is always a bit faster:

<cfset myArray = arrayNew(1)/>
<cfloop from="1" to="40000" index="i">
<cfset myArray[i]=i/>
</cfloop>
<cfset myList = arrayToList(myArray)>

<cftimer label="List" type="inline">
<cfloop list="#myList#" index="i">
<cfset myvalue = i/>
</cfloop>
</cftimer>

<cftimer label="Array" type="inline">
<cfloop from="1" to="#arrayLen(myArray)#" index="i">
<cfset myvalue = myArray[i]/>
</cfloop>
</cftimer>







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:271801
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