I've done the same... And it's quite interesting... The thing I need is not the speed of addition of items to the list (it's very quick to add something to the end of a list since it's just a string). The thing I am after is speed of retrieval of whether or not an ID already exists in a store.
Iow actually the quickest on CFMX 6.1 is a list. Quick to add to, and quick to find whether an ID exists or not! Paul > -----Original Message----- > From: Rich Wild [mailto:[EMAIL PROTECTED] > Sent: 30 September 2003 11:22 > To: '[EMAIL PROTECTED]' > Subject: RE: [ cf-dev ] Fastest data structure? > > > 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] > -- ** 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]
