Has Anyone Got A Directory \"Walker\" Available

Niggemann, Bernd Bernd.Niggemann at uni-wh.de
Sun May 6 16:06:47 EDT 2018


Alex,

a combination of "private" and referenced variables (@) improves the speed of the calls somewhat.

Kind regards
Bernd

------------------------------------------
on mouseup
   local t1, t2
   constant K = 1000
   
   local x
   constant KX = 100
   
   put the millisecs into t1
   repeat K times
      put KX into x
      repeat
         if x = 0 then exit repeat
         subtract 1 from x
      end repeat
   end repeat
   put the millisecs into t2
   put t2 - t1 & CR after msg
   
   put the millisecs into t1
   repeat K times
      put KX into x
      repeat
         if x = 0 then exit repeat
         put myfunc(x) into x
      end repeat
   end repeat
   put the millisecs into t2
   put t2 - t1 & CR after msg
   
   put the millisecs into t1
   local tA, tB, tC, tD
   put 1 into tA
   put 2 into tB
   put "333" into tC
   put "444" into tD
   repeat K times
      put KX into x
      repeat
         if x = 0 then exit repeat
         put manyParameters(x, tA, tB, tC, tD) into x
      end repeat
   end repeat
   put the millisecs into t2
   put t2 - t1 & CR after msg
   
   put the millisecs into t1
   repeat K times
      put KX into x
      recursive x
      put the result into x
   end repeat
   put the millisecs into t2
   put t2 - t1 & CR after msg
end mouseup

private function myfunc @p
   return p-1
end myfunc

private function manyParameters @p, @p1, @p2, @p3, @p4
   return p-1
end manyParameters

private command recursive @p
   if p=0 then return 0
   subtract 1 from p
   recursive p
end recursive
----------------------------------------------



More information about the use-livecode mailing list