How to get the difference between two lists?

Alex Tweedly alex at tweedly.net
Mon Apr 4 13:07:07 CDT 2005


Frank D. Engel, Jr. wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Interesting.  Note that it would not be difficult to modify that code 
> to support lists which do not meet those criteria (as long as both 
> lists are still sorted, or else you'd need to sort them first), but I 
> already lost the old stats: is this 15ms faster. or slower?

It's not "faster" or "slower". The earlier comparison compared two 
functions - "Shortlist" and "difference". "difference" is the code that 
uses arrays and delete variable - i.e. the second of the suggested 
methods from Dar, and also suggested by Monte.

Combining the previous stats and the new one, (i.e. extrapolating and 
guessing) you get something like
old Shortlist : 300
new code (and variants) : 200 + / - a bit
difference : 15

i.e. all the methods that loop through making use of the fact that the 
data in each list is sorted are significantly faster than using "among 
the lines of", but much slower than using the arrays.

> Given the problems with that one, I'm curious: how does something like 
> this compare (this version only requires that both lists are in 
> ascending numeric order):
>
looks like just another variant - I'm guessing it will be 200ms give or 
take a bit, and don't feel the need to know exactly how much plus or 
minus; the array method is clearly the one to use.

-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.6 - Release Date: 30/03/2005



More information about the use-livecode mailing list