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: Tue, 29 Jan 2002 01:43:50 +0100
>
Date: Mon, 28 Jan 2002 10:25:11 -0500
>
Subject: Re: Problems with speed & issues with coercion in OS 9.2.2 (App
>
From: Arthur J Knapp <email@hidden>
>
To: <email@hidden>
>
>
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.
This intriguing line of thinking caused me to wonder if performance was in
any way influenced by the length of text.
The results below are averages of 5 runs per test, converted to an index:
longest time = 100:
string length 'ends with' 'item -1 ='
1 character 46 71
10 characters 46 65
100 characters 48 65
1000 characters 52 64
10000 characters 100 65
The figures seem to confirm that, for most practical purposes, 'ends with'
is significantly faster. However, its performance also appears to be
affected proportionately by the length of text - while 'item -1 =' remains
remarkably consistent.
Incidentally, I checked the apparent hiccup when a string of only 1
character is evaluated. From 2 characters upwards, the average index for
'item -1 =' reverted immediately to around 65 - indicating that a slight
additional delay occurs only with a single character string (some kind of
error trap, possibly?)
My guess is that, if the two series were charted, they would cross somewhere
between 3000 and 4000 characters.
Does this offer any clues about what goes on 'under the bonnet'?
Well, at this point, perhaps I should beat a hasty retreat - and leave any
further speculation to the experts! :-P
Kai
--
**********************************
Kai Edwards Creative Resources
1 Compton Avenue Brighton UK
Telephone +44 (0)1273 326810
**********************************