• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why are compiled scripts slower than from Script Editor?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why are compiled scripts slower than from Script Editor?


  • Subject: Re: Why are compiled scripts slower than from Script Editor?
  • From: Axel Luttgens <email@hidden>
  • Date: Sun, 02 Feb 2003 13:03:56 +0100

Patrick S. Page-McCaw wrote:

[snip]

To summarize, running a simple repeat script from a stand-alone double clickable application is slower (each repeat takes longer) and more variable (the duration of the repeat varies) compared to running the identical script from within SMILE or Script Editor. Changing the priority of the stand-alone from Normal to High using Peek-a-boo does not change this result.


Really guessing here...

The problem must be inherent to the queuing mechanism; I guess the 'delayIt' command works the same way the 'delay' command does, by queing an event that should be triggered some time later.
That is, the delay may be as precise as possible, you still never master what other events get queued in the meantime, nor their priority.
If this is true, changing the app's priority can't help, since this happens outside of it.

Could you check with something like this:

set nextPulse to GetMilliSec + 500
repeat
repeat while GetMilliSec < nextPulse
end repeat
-- processing statements here
set nextPulse to nextPulse + 500
end repeat

and see if you still observe such differences between the editor and the stand-alone contexts?
Of course, this will eat a lot of your computer's CPU...
But this should at least improve the precision of the pulses.



The question is why? It is very impressive that AppleScript can do this at all, I just wish that I understood this behavior.


This is a two-parts question: why longer, and why less precise?

The precision part is partially treated above.

I suppose the 'GetMilliSec' command is from some OSAX.
I just tried here (I am on Mac OS 10) with the standard additions' command 'ASCII number' call in a loop from within Script Editor and from within a stand-alone.
It seems that 'ASCII number' is about three times longer when called from the stand-alone.
Looks like as if the editor environment did some "pre loading" of external commands - possibly what Emmanuel meant in his post.
(this makes me reminiscent of something, but very vaguely - has someone more precise records than mine?)


HTH,
Axel
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Messing with data types
      • From: Malcolm Fitzgerald <email@hidden>
References: 
 >RE: Why are compiled scripts slower than from Script Editor? (From: "Patrick S. Page-McCaw" <email@hidden>)

  • Prev by Date: Re: introspection questions
  • Next by Date: Re: Entering data into fields in a web form
  • Previous by thread: RE: Why are compiled scripts slower than from Script Editor?
  • Next by thread: Messing with data types
  • Index(es):
    • Date
    • Thread