Re: OSAX and Applescript performance
Re: OSAX and Applescript performance
- Subject: Re: OSAX and Applescript performance
- From: Christopher Nebel <email@hidden>
- Date: Mon, 28 May 2001 22:28:49 -0700
On Monday, May 28, 2001, at 02:24 PM, Jean-Marie Hoornaert wrote:
Have the number of OSAX an influence on the performances of
AppleScript ?
Can there exist "conflicts" between OSAX like by extensions ?
How do work OSAX ?
1. The number of scripting additions (osaxen to some) you have installed
doesn't much affect system performance in general or AppleScript
performance in particular. They'll consume a little bit of memory, but
that's about it.
On the other hand, calling a scripting addition in your script involves
a noticeable amount of overhead, so it may be slower than doing the same
job in pure AppleScript. On the other hand, it may not, and even if it
is, the convenience can be hard to beat. You'll have to experiment.
2. Conflicts can definitely occur, but not quite like extensions.
Instead of making each other crash, scripting additions will sometimes
trod on each others' terminology, making it impossible to call one or
the other. Additions that install coercion handlers -- Jon's Commands
is famous for this -- can also make things work in unexpected ways.
Fortunately, you generally don't have to worry about it unless you plan
to give your scripts to other people.
3. AppleScript sends commands to applications using a protocol called
Apple events. An application installs handlers for any events that it's
interested in, and does the right thing (we hope!) when they're called.
Scripting additions define additional event handlers that, via a little
magic on AppleScript's part, get inserted into every application that
runs, so a scripting addition command will be handled no matter what
application you send it to.* If you want to get into the details of how
the magic works, we can do that, but it's not really relevant to
scripters.
--Chris Nebel
AppleScript Engineering
* Well, on classic Mac OS, anyway. The rules are kind of different on
Mac OS X -- your script still works as written, but may behave a bit
differently. It's all very squirrely and amazingly difficult to
explain, so we're changing it to more closely resemble the classic
behavior.