Re: Script in Script Editor MUCH faster than compiled app -- why?
Re: Script in Script Editor MUCH faster than compiled app -- why?
- Subject: Re: Script in Script Editor MUCH faster than compiled app -- why?
- From: Axel Luttgens <email@hidden>
- Date: Fri, 02 May 2003 14:14:50 +0200
Christopher Nebel wrote:
>
On Tuesday, April 29, 2003, at 10:21 AM, Jeff Porten wrote:
>
>
> [snip]
>
>
>
> All working just fine. The thing I don't get: it's MUCH faster when
>
> I've got the script open in Script Editor, than when I save it as a
>
> compiled app and launch it. Makes no sense to me. Why is this
>
> happening?
>
>
>
Assuming you're using Script Editor 1.x, it's probably that Script
>
Editor is less friendly to background processes than applets are.
I once hypothesized that Script Editor is in some way more efficient
than applets for calling OSAXen: the speed differences really seem to
appear as soon as an OSAX is called in a script.
Do you mean that this would ONLY be related to a less friendly behavior
towards background processes?
As an example, with following script executed in Script Editor 1.9 and
as an applet:
set ToCrunch to "123.456"
-- Use 'offset' from Standard Additions
set start to current date
repeat 50000 times
set pos to offset of "." in ToCrunch
set int to text 1 thru (pos - 1) of ToCrunch
set dec to text (pos + 1) thru -1 of ToCrunch
end repeat
display dialog "Offset " & ((current date) - start)
-- Removing the call to 'offset'
set start to current date
repeat 50000 times
set pos to 4
set int to text 1 thru (pos - 1) of ToCrunch
set dec to text (pos + 1) thru -1 of ToCrunch
end repeat
display dialog "(pseudo) Offset " & ((current date) - start)
-- This one as an alternative to do similar things
-- in "pure" AS too (kind of reference)
set start to current date
repeat 50000 times
set TID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"."}
set {int, dec} to ToCrunch's text items
set AppleScript's text item delimiters to TID
end repeat
display dialog "TIDs " & ((current date) - start)
I get these execution times:
Editor Applet
Offset 15 29
(pseudo) Offset 4 3
TIDs 12 12
Just one call to an OSAX thus tends to double the execution time when
occuring in an applet.
Or am I confusing symptoms and causes?
>
This is also what leads to "delay" consuming most of your CPU when you
>
use it in Script Editor.
Damn! Never noticed it. Just what 'delay', when introduced, was intended
to avoid...
The world of programming is very frustrating ;-)
>
I believe Script Editor 2.0 fixes this.
Do you mean that, as a result, scripts now run slower in SE 2.0 than in
SE 1.x, while applets behavior is unchanged?
Or that 'delay' in SE 2.0 does not eat so much CPU anymore?
(sorry, couldn't resist...)
With all the others on this list, sincere thanks for your regular
presence and insightful comments,
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.