Re: Problems with speed & issues with coercion in OS 9.2.2 (App
Re: Problems with speed & issues with coercion in OS 9.2.2 (App
- Subject: Re: Problems with speed & issues with coercion in OS 9.2.2 (App
- From: Arthur J Knapp <email@hidden>
- Date: Mon, 28 Jan 2002 10:25:11 -0500
>
Subject: Re: Problems with speed & issues with coercion in OS 9.2.2 (App
>
Date: Sun, 27 Jan 2002 12:53:50 +0000
>
From: Nigel Garvey <email@hidden>
>
Arthur J Knapp wrote on Sat, 26 Jan 2002 18:10:52 -0500:
>
> on IsFolder( string_or_alias )
>
> return ( ( string_or_alias as alias ) as string )'s item -1 = ":"
>
'Ends with' is about twice as fast as 'item -1 =' in a straight race, so
>
that would contribute slightly more still to the speed here:
>
return (string_or_alias as alias as string) ends with ":"
Wow, that's great. :)
If one were to speculate about things behind the scenes, it might be
that AppleScript's "end of" syntax simply goes to the last item, where
as a negative index might actually cause AS to go into "counting mode",
ie: it begins a backwards traversal through the string until it comes
to item -1. Obviously, it would get to item -1 rather quickly, but with
the "end of" syntax, it wouldn't even begin a traversal in the first
place.
{ Arthur J. Knapp, of <
http://www.STELLARViSIONs.com>
<
mailto:email@hidden>
try
<
http://www.appleklub.cz/~koudelka/home.shtml>
on error number -128
end try
}