• 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: Faster List Checking
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Faster List Checking


  • Subject: Re: Faster List Checking
  • From: Paul Skinner <email@hidden>
  • Date: Thu, 29 May 2003 11:01:33 -0400

On Wednesday, May 28, 2003, at 05:20 PM, Frank W. Walker wrote:

This is the kind of basic knowledge I am sadly lacking and that I was hoping to get when I tossed my fishing line in the Applescript Users pool. Thanks!


RTFM. <http://manuals.info.apple.com/Apple_Support_Area/Manuals/servers/ AppleScriptLanguageGuide.PDF>

Frank

----------
From: Andrew Oliver
Sent: Wednesday, May 28, 2003 5:15 PM
To: Frank W. Walker; Applescript Users (E-mail)
Subject: Re: Faster List Checking

A couple of things come to mind here, some general, and some specific to
your script.


snip


Also, the line:

repeat with i from 1 to (count text items in errorlist)

Can be optimized to:

set numItems to count text items in errorList
repeat with I from 1 to numItems

In the original form, the script will calculate the 'count text items in
errorlist' each time it goes through the loop.

Not true.

By precalculating the number of items in the list you save time.
You can only use this technique when you know the list won't change. If
you're adding or subtracting items from the list you need to recalculate the
number of items in the list on each iteration, but in your script there's no
need.


Also not true.

The evaluation of an argument in a repeat loop happens once; prior to entering the loop.

Paul
_______________________________________________
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.

  • Prev by Date: RE: applescript-users digest, Vol 3 #1694 - 18 msgs Re: Extraneou s osascript output
  • Next by Date: Re: Is a 'put away' script possible for Entourage 2001?
  • Previous by thread: RE: Faster List Checking
  • Next by thread: RE: Faster List Checking
  • Index(es):
    • Date
    • Thread