Intersecting data question/challenge

jbv jbv.silences at Club-Internet.fr
Fri Jul 8 16:27:36 EDT 2005



Dennis,

Using arrays will always be a speed improvement.

My script creates arrays from your lists of items with loops
just for the purpose of the demonstration. As someone else
suggested, you can use "split" to create your arrays, or better :
drop your lists of items and configure your data as arrays
from the beginning.

Just for the anecdote, I have a cgi script that makes extensive
use of arrays (and only arrays), and it builds 16 pages pdf
files of about 1.4 Mb in roughly 0.1 second, while the previous
version (using items lists) took 3 to 4 seconds...

JB

> JB,
>
> It will work, but not a speed improvement.
> It will run about 8 times slower than my original example.
> It takes Rev a lot of work (time) to create an array element.
>
> Dennis
>
> On Jul 8, 2005, at 2:50 PM, jbv wrote:
>
> >
> >
> > Dennis,
> >
> > Use arrays; Something like :
> >
> > put "" into myT1
> > put "" into myT2
> > repeat for each item i in list1
> >     put 1 into myT1[i]
> > end repeat
> > repeat for each item i in list2
> >     put 1 into myT2[i]
> > end repeat
> >
> > get the keys of myT1
> > repeat for each line j in it
> >     if myT2[j]=1 then
> >         get true
> >         exit repeat
> >     end if
> > end repeat
> >
> > JB
> >
> >
> >> Hello clever Rev programmers,
> >>
> >> I have a simple question or maybe it is a simple challenge.
> >>
> >> I have two lists of integers.  The list are not long, perhaps 5 to 50
> >> items e.g.:
> >> list1="310,423,522,211,107,340,"
> >> lis2="311,312,313,318,320,323,325,330,333,337,340,"
> >>
> >> I want to find if any of the items in list1 have a match in list2.
> >> I know I could do it with a repeat, something like this:
> >>
> >> get false
> >> repeat for each item theItem in list1
> >>    if theItem is not among the items of list2 then next repeat
> >>    get true
> >>    exit repeat
> >> end repeat
> >>
> >> I was wondering if it could be done faster without a repeat through
> >> some Rev trick.
> >>
> >> Dennis
> >> _______________________________________________
> >> use-revolution mailing list
> >> use-revolution at lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-revolution
> >>
> >
> > _______________________________________________
> > use-revolution mailing list
> > use-revolution at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-revolution
> >
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list