Re: Problems with speed & issues with coercion in OS 9.2.2
Re: Problems with speed & issues with coercion in OS 9.2.2
- Subject: Re: Problems with speed & issues with coercion in OS 9.2.2
- From: Kai Edwards <email@hidden>
- Date: Sun, 27 Jan 2002 09:23:45 +0100
>
Date: Sat, 26 Jan 2002 19:35:43 -0800
>
Subject: Re: Problems with speed & issues with coercion in OS 9.2.2
>
From: Paul Berkowitz <email@hidden>
>
To: Applescript-Users <email@hidden>
>
>
On 1/26/02 6:23 PM, "Kai Edwards" <email@hidden> wrote:
>
>
> I can get a reasonable speed improvement from:
>
>
>
> on IsFolder(FullItemPathAndName)
>
> folder of (info for FullItemPathAndName)
>
> end IsFolder
>
>
>
> - or an even faster response from:
>
>
>
> on IsFolder(FullItemPathAndName)
>
> last text item of (FullItemPathAndName as string) = ":"
>
> end IsFolder
>
>
That would depend on first making sure that text item delimiters are set to
>
{""}. (Alternately, you might use 'last character', good in all
>
circumstances, but that's probably slower).
Point taken.
Actually, your note aroused my curiosity and caused me to revisit the
question of speed - since my initial tests had been somewhat superficial.
This time, I took an average of the elapsed ticks for 5 runs on each
calculation method - looping the handler 1000 times per run.
There were 2 versions for the 'last text item' method. The first session
reset the text item delimiters just once (before the repeat loop), while the
second (obviously slower) version incorporated the reset within the loop.
The results were then translated into an index: slowest method = 100. This
is how they panned out - listed from slowest to fastest:
last text item (multi tid reset): 100
last text item (single tid reset): 94
last chararacter: 67
original script: 55
folder of info for: 49
So clearly you were right to question my earlier impressions. I don't know
if these results square with generally held perceptions about the different
methods - but a couple of them surprised me.
(I've since seen Arthur's comprehensive advice about the original problem -
which will hopefully result in a solution.)
Kai
--
**********************************
Kai Edwards Creative Resources
1 Compton Avenue Brighton UK
Telephone +44 (0)1273 326810
**********************************