I just upgraded my desktop machine to CFMX 6.1 - it was on one of the 6.1
betas

ok - after my testing on proper 6.1 I have the following conclusions for
data retrieval:

It depends on where the value being searched for exists in the data.
If a value is at pos 1999 of a 2000 length dataset, then a listfind of a
list will prob be much quicker than a 1999 step iteration of the equivalent
array.
But if the value is at the beginning of the data, then the array stepping is
faster.

Given that you're searching, you'll probably never know where the value is,
so its prob safer to go for listfind() for more consistent results.

In most instances, I found that the structfindkey() method was usually the
middle speed result (I did 50 page calls using a 10000 key dataset)

generally, the listfind() option was fastest.

However, setting values is different.

In my tests (setting 10,000 keys) I found that to set those keys to a
variable, arrays were way faster than the other 2, but structs had amazing
performace compared to lists, which were very very poor indeed.

Averages over 50 runs (on my underpowered desktop machine - PIII 500Mhz):

Structs: 1259ms
Arrays:   142ms
Lists:  68834ms

so to save multiple values to a variable - I would use arrays. To then
search them, perhaps arraytolist and listfind? Not sure if the arraytolist
would take longer than its worth.

Its worth stating that this is only important when dealing with heavy data
load applications. I write apps that regularly need to save anywhere up to
400,000 and beyond values to variables. If we're talking about low numbers
(hundreds) then use any method you like - you probably won't see a
difference in speed.

I'd be interested to see if anyone has any wildy differing results which
would put new light on things.

Rich

> -----Original Message-----
> From: Paul Johnston [mailto:[EMAIL PROTECTED]
> Sent: 30 September 2003 13:09
> To: [EMAIL PROTECTED]
> Subject: RE: [ cf-dev ] Fastest data structure?
> 
> 
> Believe it or not... The fastest way to do a lookup of a 
> value is NOT using
> a list or an array, but a structure (which is probably how it 
> should be)!
> 
> It does not matter what the structure key is, because you can do:
> 
> Structfindvalue(structure, value)
> 
> And this is consistently quicker than listfind(list, value) 
> or looping over
> an array to check the value stored in it!
> 
> 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