Making Revolution faster with really big arrays

Dennis Brown see3d at writeme.com
Thu Apr 14 10:09:34 EDT 2005


Dick,

Thanks for your various tips and help online and offline.  I need to 
take a week to digest and incorporate the ideas into a real piece of 
code that I hope will fly like the wind --then I will share my code and 
a data generator for you and everyone else to see and rip to shreds ;-)

Thanks again,
Dennis

On Apr 13, 2005, at 5:41 AM, Dick Kriesel wrote:

> On 4/12/05 7:36 PM, "Dennis Brown" <see3d at writeme.com> wrote:
>
>> ...I have two arrays 10,000 lines with 2500 items in each line...
>> ...I need to pair the items together...
>
> Do you have something like closing prices in one container and shares 
> traded
> in another container, each for the same 10,000 securities over the same
> 2,500 trading days?  If so, do you want to calculate something like 
> trading
> volume as price * shares?
>
> If so, then here's a way to bring together the values from one such 
> list
> with the values from another, without waiting for any chunk 
> expressions.  On
> my machine, generating a 10,000 line by 2,500 item list of integers to
> prepare for the test took about three minutes.  Then bringing together 
> all
> the pairs of lines from two lists, as you indicated in your initial 
> email,
> took about 1.2 seconds.
>
> So you could do many passes through your big lists before the day is 
> done,
> and not need to wait for an extension to the language.
>
> To try it, paste the following into the script of a new stack.  If I've
> misunderstood or done something wrong, please let me know.
>
> -- Dick
> ---------------------
> global gList
>
> on mouseUp
>   if gList is empty then initialize
>   combinePairsOfLines gList,gList
> end mouseUp
>
> on initialize
>   put 10000 into tLineCount
>   put 2500 into tItemCount
>   put tLineCount && tItemCount & cr
>   put the seconds into tSeconds
>   repeat with i = 1 to tLineCount
>     repeat with j = 1 to tItemCount
>       put i + j & comma after tList
>     end repeat
>     put return after tList
>     if i mod 1000 = 0 then put "line count so far:" && i & cr after msg
>   end repeat
>   put tList into gList -- save for reuse across edit-test cycles
>   put "elapsed seconds to initialize:" && \
>       the seconds - tSeconds & cr after msg
> end initialize
>
> on combinePairsOfLines pList1,pList2
>   put the long seconds into tSeconds
>   split pList2 using return
>   put 0 into i
>   repeat for each line tLineFromList1 in pList1
>     add 1 to i
>     put tLineFromList1 & pList2[i] into tCombinedLine
>     -- doSomethingWithCombinedLine tCombinedLine
>   end repeat
>   put "elapsed seconds to combine pairs:" && \
>       the long seconds - tSeconds & cr after msg
> end combinePairsOfLines
>
>



More information about the use-livecode mailing list