Speeding up array initialization

Dar Scott dsc at swcp.com
Sat Nov 22 21:48:09 CST 2003


On Saturday, November 22, 2003, at 08:21 AM, jbv wrote:

> Now, I want to use a two-dimensional array instead of a variable.
> To initialize each cell of the array to 0, I can run this script :
>
> on mouseUp
>   put "" into S
>   repeat with j=1 to 100
>     repeat with i=1 to 100
>       put 0 into S[j,i]
>     end repeat
>   end repeat
> end mouseUp
>
> This script takes about 115 ticks.

Seven seconds?

Something is wrong.  This takes only 135 ms on my 1.25 GHz G4 on OS X 
using Rev 2.1.1.  I would guess only half a second on a G3 at 300 MHz 
using the same Revolution build.

Dar Scott





More information about the use-livecode mailing list