Scott Brady wrote:
>> Hi everyone. I am looking for a way to compare 2 different lists of
>>  information, and after comparing them keep which records are
>> exactly the same.
> 
> 
> I'd probably convert them both to arrays. Then, I'd loop along the
> first array and look for each element within the second array.  If it
> exists in the second array, keep it; otherwise, delete that element
> from the first array.  When you're done, whatever's left in the first
> array should be the items you need.
> 
> You can do that keeping them as lists, but I think it'd be faster
> with arrays.
no, structures would be faster would be
faster...though where you use the

load dataset1 into a structure
load dataset2 into a structure

loop over dataset2
        if (NOT structkeyexists(dataset1,dataset2.id))
                structdelete(dataset2,dataset2.id);

or not deleete etc
                
this is faster because the lookup is random, ( reminds be of basic data
handling in MBASIC on my old CP/M box) structures are always faster for 
random access

the array approach too much overhead, ie looping over 
dataset1.recordcount  dataset2.recordcount times

so 500 x 500 250000 loops!

above ends up being 1500 loops

z

z


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Reply via email to