Here's the same solution, but with 1000001 records. On my machine, over 3
runs I get, 4924 millisec, 4932 ms, 4914 ms.

I'm sure others will now improve on that.

There are a couple of extra lines to do the timing which you'd remove for
your solution.

on mouseUp
   --create the dummy list
   put 1000000 into tRepeat
   put 10 & tab & 5 & cr after tStore
   put 10 into tLast
   repeat tRepeat times
      put (10 * random(5) + tLast) into tLast
      put tLast & tab & random(30) & cr after tStore
   end repeat

   --do the work here
   set the itemDelimiter to tab
   put the millisec into tStartTime
   put "first" into tLastItem
   repeat for each line tLine in tStore
      put item 1 of tLine into tCheck
      switch
         case (tLastItem = "first")
            --don't do anything
            break
         case (tCheck - tLastItem > 20)
            put tLastItem + 10 & tab & 0 & cr after tStore2
            put tCheck - 10 & tab & 0 & cr after tStore2
            break
         case (tCheck - tLastItem > 10)
            put tCheck - 10 & tab & 0 & cr after tStore2
            break
      end switch
      put tLine & cr after tStore2
      put tCheck into tLastItem
   end repeat
   put the millisec into tEndTime
   put (tEndTime - tStartTime) & "ms" into msg
end mouseUp
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to