Re: max script size
Re: max script size
- Subject: Re: max script size
- From: Martin Crisp <email@hidden>
- Date: Fri, 21 Mar 2003 9:30:01 +1100
- Organization: Tesseract Computing
On Thu, 20 Mar 2003 0:55:15 +1100, has wrote
(in message <
a05200f03ba9eb5327eb6@[62.31.89.44]>):
>
Martin Crisp wrote:
>
>
> If the subscripts needed to refer to properties of the main script
>
> then they needed to refer to 'theProperty of current application'.
>
>
Rather an odd way of doing it. The usual hack involves mucking with
>
globals (which I've found tends to lead to rats' nest code). Most
>
solid approach I've found is to pass the main script into the
>
subscript, either as an extra parameter to the handlers that use it,
>
or in a separate operation, stuffing it into a property in the
>
subscript where it can be referenced by the subscript's handlers. If
>
it starts getting complicated, it's a good hint that the dividing
>
lines have been drawn in the wrong places and should be moved.
While it wasn't much different to 'mucking with globals' the
problem was rather obviously divisible into chunks. The degree of
ratiness it did have (at that level, at least) was largely due to
my failure to get sub-sub-scripts happening.
As far as passing main as a parameter or stuffing it into a
property: that's, unfortunately, right at the fringe of my
understanding of AS, and was totally outside my understanding when
I wrote the initial scripts a couple of years ago.
>
> I couldn't ever get attempts at sub-sub-scripts to work.
>
>
Not an AppleScript problem. Must've been something in your design.
That doesn't surprise me at all :-/
>
> I noticed a substantial speed improvement when I amalgamated my
>
> scripts into a single script, but I can't put a figure on how much
>
> that had to do with the amalgamation and how much to do with the
>
> OS9->X changes I made. That said, the speed differece was a factor
>
> of 3 to 4. On that basis I'd suggest you not split the script up
>
> unless you absolutely have to, but others may have different
>
> experiences...
>
>
Your speedup would be almost entirely due to your other code changes
>
and generally improved performance in OS X. The time it takes
>
AppleScript to resolve the reference to the script object is
>
insignificant compared to the time it takes it to do most everything
>
else. So there's no justification for saying "don't split up the
>
script". (Get yourself a timing osax such as GetMilliSec and run some
>
tests if you're not convinced.)
That makes sense, so I won't bother with GMS for that purpose
(there are still some areas of the code that could do with some
rewriting, and I'll probably use it in there, though...). Thanks
for correcting my impression...
Have Fun
Martin
--
I have absolutely no reason to complain about "success" with my
work; [...] And yet, from time to time a boundless sense of
inferiority plagues me, a desperate feeling of general failure; how
does a person acquire such bits of lunacy?
- MC Escher
Almost always SMASHed
_______________________________________________
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.