On Oct 31, 2011, at 5:24 PM, Alex Zavatone wrote: Here is the code that I'm rerunning to check how much overhead each call takes.
Hi Alex,
That's an nice way to determine the timer's overhead. Thanks for that!
I was just going to suggest another timing tool that's included with AppleMods Loader, the AS library system built by Hamish Sanderson. Specifically, the AppleModsTools.osax includes the AMTime command, which provides the number of seconds since 1 January 1970 0:00:00 GMT with microsecond precision.
Here's a sample of usage for script timing: set startTime to AMTime set n to 0 repeat with i from 1 to 1000000 set n to n + 1 end repeat set elapsedTime to (AMTime) - startTime --> 1.240820884705
You can download the complete Loader project from here, which includes the osax binary:
XCode source for the osax is available here:
The latest revision of the osax is from July 2010, so it's of relatively recent vintage.
Using your method, it appears the overhead for AMTime is approximately 0.001 seconds on my 2.4 GHz Core 2 Duo MacBook Pro running 10.6.8. Of course, one would expect an osax to be faster than a call to do shell script.
Stan C.
|