Section 22.1. Tools of the Trade


22.1. Tools of the Trade

In order to improve speed, you have to measure it. At the crudest level, you can do this with the current date command, which captures the date-time at the moment it is issued, but this is good only to the nearest second. A better choice is the command the ticks from the Jon's Commands osax; this is particularly good for timing things, since a tick is about one-sixtieth of a second. Examples will appear later in this chapter.

Script Debugger can also help you quantify speed. It doesn't yet provide true code profiling (reporting the time spent on different sections of your code), but it does report how long the script took to run and how much of that time was spent within AppleScript and how much was spent sending Apple events and how many Apple events were sent. It also provides code coverage, indicating what lines of your code were actually executed, so you don't waste effort optimizing areas of your script that aren't doing anything.




AppleScript. The Definitive Guide
AppleScript: The Definitive Guide, 2nd Edition
ISBN: 0596102119
EAN: 2147483647
Year: 2006
Pages: 267
Authors: Matt Neuburg

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net