• 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: Speeding Up Scripts 101
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Speeding Up Scripts 101


  • Subject: Re: Speeding Up Scripts 101
  • From: "Serge Belleudy-d'Espinose" <email@hidden>
  • Date: Mon, 4 Mar 2002 11:28:37 +0100

At 20:18 -0800 3/03/02, Paul Berkowitz wrote:

set MyOutput to {}

repeat with i from 1 to 2000
set end of MyOutput to "some more data " & i -- or whatever
end repeat

set AppleScript's text item delimiters to {return}
set MyOutput to MyOutput as string
set AppleScript's text item delimiters to {""}
MyOutput

This remains the best technique if the list is to be created in one loop. However, when repeatedly accessing and modifying a list, it's much faster to put it in a script object:

--------------------------------
-- build list
set vList to {}
set vRange to 1000
repeat with i from 1 to vRange
set end of vList to i
end repeat
-- slow
-- set tStart to the ticks -- uncomment this...
repeat with i from 1 to vRange
get item i of vList
end repeat
-- fast
-- set tMiddle to the ticks -- ...and this...
script vScript
property xList : missing value
end script
tell vScript
set its xList to vList
repeat with i from 1 to vRange
get item i of its xList
end repeat
end tell
-- set tStop to the ticks -- ...and this...
-- {tMiddle - tStart, tStop - tMiddle} -- ...and this if you use Jon's Commands
--------------------------------


Serge
--
\\//\//\// Serge Belleudy-d'Espinose Institut Jacques Monod - Jussieu
// // // http://www.ijm.jussieu.fr/ Universites Paris VI, VII - CNRS
//\//\//\\
_______________________________________________
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.

References: 
 >Re: Speeding Up Scripts 101 (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: Damn send button / Wind chill (nesting more efficient shock)
  • Next by Date: Re: Damn send button / Wind chill (nesting more efficient shock)
  • Previous by thread: Re: Speeding Up Scripts 101
  • Next by thread: Re: Speeding Up Scripts 101
  • Index(es):
    • Date
    • Thread