just to qualify that, take the following code to compare the two (I'm
populating an array and list with email addreses and then searching for a
particular one):

<cfscript>
myList = "";
myArray = arraynew(1);
myArrayResult = "";
myListResult = "";

arraythen = gettickcount();
for (i=1;i lte 2000;i=i+1) {
        arrayappend(myArray, "[EMAIL PROTECTED]");
}
for (i=1;i lte arraylen(myArray);i=i+1) {
        if (myArray[i] eq "[EMAIL PROTECTED]") {
                myArrayResult = myArray[i];
                break;
        }
}
arraynow = gettickcount();

listthen = gettickcount();
for (s=1;s lte 2000;s=s+1) {
        myList = listappend(myList, "[EMAIL PROTECTED]");
}
myListResult = listgetat(myList,
listfind(myList,"[EMAIL PROTECTED]"));
listnow = gettickcount();
</cfscript>
<cfoutput>
Arraytime = #arraynow-arraythen#<br>
Listtime = #listnow-listthen#
</cfoutput>

and the results?

ArrayTime       ListTime
311             3104
101             2904
161             2623
60              2634
130             2744

expect a bigger difference with higher numbers than 2000 iterations.

> -----Original Message-----
> From: Paul Johnston [mailto:[EMAIL PROTECTED]
> Sent: 30 September 2003 11:08
> To: [EMAIL PROTECTED]
> Subject: RE: [ cf-dev ] Fastest data structure?
> 
> 
> > my experience with high traffic stuff like this is to store 
> > them as arrays.
> > 
> > Quick as lightning to add.
> > 
> > In loe levels, you can't really tell the difference between an 
> > 
> > arrayappend(myArray, "kjsdlkjljdadjldja")
> > and
> > myLIst = listappend(myList, "kjsdlkjljdadjldja")
> > 
> > but once you start adding large numbers of keys, the list 
> > method starts to slow down very quickly. Converting them to 
> > arrays gave me a **very** big perfomance increase, even when 
> > having to use search the array for a particular key afterwards.
> 
> That helps.  Ta
> 
> Paul
> 
> 
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
> 


-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to