I did two test using the basic code below.
First test exactly like below using a list.
2nd test, modifying the below to build an array instead of a list and 
checking for a duplicate value in the array

The query used returned a list of close to 14,000 email addresses....

Average total time in both cases was around 400 milliseconds (out of 
running the code 20 times or so)
On the average, the list compare method edged out the array by 10 or 20 
milliseconds, BUT - sometimes the array method won out.
Not sure what I learned from that. The list method is slightly less code 
and I've got that working already. Think I'll leave it as is.
At the most, this type of thing only gets run a few times a day, so it's 
not constantly chewing server resources.
---------------------------------------------------------------------------------------------------------------------------------

<cfset req.thisLIST = "lesm...@bellsouth.net,someonee...@somewhere.com">
<cfset sTime = getTickCount()>
<cfquery name="rmailLIST">BIG QUERY HERE THAT RETURNS 14,000 email 
addresses</cfquery>

<p>Time after Initial Query: <cfoutput>#evaluate(getTickCount() - 
sTime)# milliseconds</cfoutput></p>

<cfset req.groupLIST = #valuelist(rmailLIST.ml_email)# />

<p>Time after Build List: <cfoutput>#evaluate(getTickCount() - sTime)# 
milliseconds</cfoutput></p>

<cfoutput>
<cfloop list="#req.thisLIST#" index="i">
<cfif IsDefined("i") AND isVALID("email", "#i#") AND NOT 
listfindnocase(req.groupLIST,#i#)>
<p>#i# wasn't found</p>
<cfelse>
<p>#i# was found</p>
</cfif>
</cfloop>
</cfoutput>

<p>Time after CHECK LIST: <cfoutput>#evaluate(getTickCount() - sTime)# 
milliseconds</cfoutput></p>


 > I have created a new blog post where I have taken the code for 
indexOf() from java and
 > modified it to work in this manner for ColdFusion.
 > -- Regards, Andrew Scott WebSite: http://www.andyscott.id.au/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351010
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to