Arrays: new and old keys, i

Mark Smith lists at futilism.com
Sun Sep 14 04:54:27 EDT 2008


Also, there seems to be a speed advantage with using the multi- 
dimesional arrays:

on mouseUp
    put the millisecs into ts
    repeat with i = 1 to 1000
       repeat with j = 1 to 1000
          put "counting" into tArray[i,j]
       end repeat
    end repeat
    put the millisecs - ts into inTime

    put the millisecs into ts
    repeat with i= 1 to 1000
       repeat with j = 1 to 1000
          get tArray[i,j]
       end repeat
    end repeat
    put the millisecs - ts into outTime

    put the millisecs into ts
    repeat with i = 1 to 1000
       repeat with j = 1 to 1000
          delete variable tArray[i,j]
       end repeat
    end repeat
    put the millisecs - ts into deleteTime

    put inTime && outTime && deleteTime
end mouseUp

this produced "3537 2331 3342"

replacing tArray[i,j] with tArray[i][j] produced "2846 1741 2761"  
which is a 25-30% gain, which could be useful when dealing with large  
arrays.

Best,

Mark



More information about the use-livecode mailing list