• 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
Embedded Script Objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Embedded Script Objects


  • Subject: Embedded Script Objects
  • From: Adam Bell <email@hidden>
  • Date: Sat, 20 May 2006 19:40:10 -0300

I have seen it stated several times in several places that the manipulation of large lists is faster if the lists are properties of embedded script objects within the script than if they are simply part of the script. For example this simple ASCII sort should run faster with the internal script than it does without:

script BL
	property Big_List : { a list of 1500 words }
	property index_list : {}
	property sorted_list : {}
end script

set t1 to GetMilliSec
repeat (count of BL's Big_List) times
	set the low_item to ""
	repeat with i from 1 to (count of BL's Big_List)
		if i is not in the BL's index_list then
			set this_item to item i of BL's Big_List as text
			if the low_item is "" then
				set the low_item to this_item
				set the low_item_index to i
			else if this_item comes before the low_item then
				set the low_item to this_item
				set the low_item_index to i
			end if
		end if
	end repeat
	set the end of BL's sorted_list to the low_item
	set the end of BL's index_list to the low_item_index
end repeat
set t2 to GetMilliSec
t2 - t1

After testing this a bit with a 1500-word list, I haven't found that to be the case for every run; and have found the results to be quite variable, in fact.

Am I doing something wrong, or is the original assertion incorrect?

Adam Bell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Searching GAL in Entourage
  • Next by Date: Re: Icon View and Disk Images
  • Previous by thread: Re: Searching GAL in Entourage
  • Next by thread: Re: Embedded Script Objects
  • Index(es):
    • Date
    • Thread