Timing oddity

Geoff Canyon gcanyon at gmail.com
Sat Jan 25 23:19:32 EST 2014


gah, third time's the charm, or I'm giving up.

on mouseUp
   repeat with arrayLog = 1 to 6
      put 10^arrayLog into arrayCount
      put 10^(6 - arrayLog) into repeatLoopCount
      repeat with i = 1 to arrayCount
         put random(100) into X[i]
         put random(10) into Y[i]
      end repeat
      put the long seconds into T
      repeat repeatLoopCount
         repeat with i = 1 to arrayCount
            add Y[i] to X[i]
         end repeat
      end repeat
      put the long seconds - T into T1
      put the long seconds into T
      repeat repeatLoopCount
         repeat for each key K in X
            add Y[K] to X[K]
         end repeat
      end repeat
      put the long seconds - T into T2
      put the long seconds into T
      repeat repeatLoopCount
         add Y to X
      end repeat
      put the long seconds - T into T3
      put "array size:" && arrayCount & cr & \
            "index:" && T1 & cr & \
            "keys:" && T2 & cr & \
            "whole array:" && T3 & cr & \
            "index ratio:" && T1 / T3 & cr & \
            "keys ratio:" && T2 / T3 & cr & cr & cr after R
      delete variable X
      delete variable Y
   end repeat
   put R
end mouseUp




More information about the use-livecode mailing list