RE: speed advantage of OSAXen
RE: speed advantage of OSAXen
- Subject: RE: speed advantage of OSAXen
- From: Joe Kelly <email@hidden>
- Date: Fri, 25 Jan 2002 16:08:10 -0800
Olof Hellman schreibt:
>
There are very measurable speed advantages. When an
>
application handles an
>
AppleEvent, a context switch is made to the application
>
context, and the
>
event has to come in through the cooperative multitasking
>
event dispatch of
>
MacOS. The exception is when an application dispatches an
>
event to itself:
>
in this case there's no need for a switch because the app is
>
already the
>
current process. (MacOS X changes the event dispatch quite a
>
bit -- can
>
anyone comment on the situation there?)
>
>
No such context switch is required for events handled by OSAX
>
-- they live
>
inside the system.
>
So you're saying that OSAXen live in the applet's (or editor's) context,
whereas separate apps are their own little worlds.
I know very little of the underlying implementation of AppleScript. Are
OSAXen loaded on demand, or do they all get loaded when the applet launches?
CFM load time can sometimes be a noticeable factor, especially a frag that
links to something like CarbonLib (however, I still think it's amazingly
fast for what it's doing).
With the pre-emptive tasking model introduced on OS X, things are slightly
different. Context swaps are invisible to the process. Since AppleEvents
have always required developers to install handlers (which are still
optional in Carbon for all other "events"), the time involved in event
dispatch really becomes a factor of the system's current workload, from what
I can tell.
jk