On 4/3/05 7:49 PM, "Richard Gaskin" <[EMAIL PROTECTED]> wrote: > > With 10,000 lines in my main list and 5,000 lines in my exclude list, it > takes only 25 milliseconds to use this on my single-processor PBG4 1MHz: > > > function ShortList pList, pExcludelist > repeat for each line tLine in pList > if tLine is not among the lines of pExcludeList then > put tLine & cr after tNulist > end if > end repeat > delete last char of tNuList > return tNuList > end ShortList
Wow, that's fast. So I decided to compare it to an implementation of Dar's second suggestion, which I've been using for a long time. The test I tried yields times very different from Richard's. Even though my machine is a dual 2 GHz G5, function "Shortlist" took almost a hundred times longer than Richard reported. I wonder why the times are so different. But the other function ran almost 70 times faster than function "Shortlist." Here are the other function, the "test" handler, and the test results: function difference pList1,pList2 split pList1 with return and tab repeat for each line tLine in pList2 delete variable pList1[tLine] end repeat return the keys of pList1 end difference --------------------- on test repeat with i = 3 to 30000 step 3 -- 10000 multiples of 3 put i & cr after tBig end repeat delete last char of tBig put "number of lines in tBig:" && number of lines in tBig & cr repeat with i = 2 to 10000 step 2 -- 5000 multiples of 2 put i & cr after tLittle end repeat delete last char of tLittle put "number of lines in tLittle:" && number of lines in tLittle \ & cr after msg put the milliseconds into tBefore put shortList(tBig,tLittle) into tDiff1 put the milliseconds into tAfter put "elapsed milliseconds for Shortlist:" && (tAfter - tBefore) \ & cr after msg put the milliseconds into tBefore put difference(tBig,tLittle) into tDiff2 put the milliseconds into tAfter put "elapsed milliseconds for difference:" && (tAfter - tBefore) \ & cr after msg sort tDiff2 numeric put "matching results:" && (tDiff1 = tDiff2) & cr after msg end test --------------------- number of lines in tBig: 10000 number of lines in tLittle: 5000 elapsed milliseconds for Shortlist: 2423 elapsed milliseconds for difference: 35 matching results: true _______________________________________________ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution