« | Home | »

AppleScript Profiling

An Script Debugger feature that I’ve been pondering for a long time is a profiler. Given that Script Debugger’s debugger has the ability to track each statement executed, I can capture quite a bit of data about time spent in handlers, and even particular statements. I can also track AppleEvents back to the statement that initiated them.

A little bit of this information is presented in the existing Script Debugger interface. Firstly, the script timer (bottom of result drawer) displays the number of AppleEvents sent and breaks execution time down into time spent executing in AppleScript and time spent waiting for AppleEvents. The AppleEvent Log window’s contextual menu lets you go to the source statement that generated a particular AppleEvent.

My experience is that most AppleScript performance issues can be traced to inefficient sending of AppleEvents to other applications. As a result, my curiosity is in the tracking of events sent to other applications. But my usage patterns tend to avoid implementing anything but the most trivial algorithms in AppleScript due to its poor string handling and list performance. I also tend to avoid the use of script objects because of they are quite buggy in my experience.

Given all this, what are the questions you need an AppleScript Profiler to answer? Feel free to add a comment to this post or email me directly with your thoughts.

About this entry