Hi,
I've been working on a few scripts that involve loops and calculations. I was wondering if there was a way to time a script to see if changes in coding really make a difference in speed - especially since some of the calculations will be repeated - and so small decreases in speed could add up.
I've tried millsec - but that does not seem to be sensitive enough.
Ticks are worse.
Any thoughts?
Timing Scripts
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 10045
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
True, milliseconds are often too granular to see performance differences.
The approach I take is to write a sample script which puts these through a loop for multiple iterations, e.g.:
The approach I take is to write a sample script which puts these through a loop for multiple iterations, e.g.:
Code: Select all
on mouseUp
put 100 into n
-- test 1:
put the millisecs into t
repeat n
DoSomething
end repeat
put the millisecs - t into t1
--
-- test 2:
put the millisecs into t
repeat n
DoSomethingElse
end repeat
put the millisecs - t into t2
--
put t1 && t2
end mouseUp
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn