[script optimization challenge] Multi dimensional array filtering

Mark Wieder mwieder at ahsoftware.net
Wed Aug 5 12:50:49 EDT 2009


Malte-

Here's my attempt. Putting the results into a variable instead of an
array element seems to shave about 25% off the total run time. I'm
assuming you want the results here rather than just a count - doing a
total count is quite a bit faster than accumulating the actual hits.

on mouseUp
    local testarray,tprocess,test
    local newVar

    put empty into newVar
    repeat with i=1 to 30000
        put any item of "meier,müller,john,doe" into testarray[i]["name"]
    end repeat
    put the millisecs into test
    put the keys of testarray into tprocess
    repeat for each line x in tprocess
        if "john" is in testarray[x]["name"] then
            put x & cr after newVar
        end if
    end repeat
    answer the number of lines of newVar & cr & the millisecs-test
end mouseUp

-- 
-Mark Wieder
 mwieder at ahsoftware.net




More information about the use-livecode mailing list