• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problems with speed & issues with coercion in OS 9.2.2 (App
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Nigel Garvey <email@hidden>
  • Date: Tue, 29 Jan 2002 01:52:53 +0000

Victor Yee wrote on Mon, 28 Jan 2002 16:17:25 -0500:

>On Mon, 28 Jan 2002 10:25:11 -0500, Arthur J Knapp wrote,
>
>> > 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.
>
>Does that mean that "items 1 thru end" would be more efficient than "items 1
>thru -1"?

"Items" by itself would be best here. ;-) But the forms "thru end" and
"thru -1" appear to take about the same time. They both simply identify
the end of the string. They don't try to identify the character there.

My own guess is that "ends with" gets its speed advantage from simply
comparing the ends of the strings, using the AppleScript's built-in code
for that function. "Character -1 =" has first to get character -1 of the
main string and *then* compare it with the other character - the same
basic process, but two AppleScript stages rather than one. As I said,
this is only a guess, but it seems plausible.

NG


  • Prev by Date: Multiple Command Scripting Additions
  • Next by Date: Re: Problems with "load script" revisited
  • Previous by thread: Re: Problems with speed & issues with coercion in OS 9.2.2 (App
  • Next by thread: Re: Problems with speed & issues with coercion in OS 9.2.2 (App
  • Index(es):
    • Date
    • Thread