Re: applescript-users digest, Vol 3 #2735 - 22 msgs
Re: applescript-users digest, Vol 3 #2735 - 22 msgs
- Subject: Re: applescript-users digest, Vol 3 #2735 - 22 msgs
- From: Matthew Strange <email@hidden>
- Date: Thu, 3 Jun 2004 23:51:42 -0400
On Jun 3, 2004, at 9:35 PM, Paul Berkowitz wrote:
I want to manipulate a list by taking some items out....
You can improve performance by using 'set' rather than copy...
I normally trust Paul's advice without question, but this assertion
caught me off guard. So I did some testing, and at its simplest level,
copy and set seem to me to be identical. On my G4/1.2GHz running
10.3.4...
set ListA to {}
repeat 10000 times
copy "a" to the end of ListA
end repeat
takes 23 seconds
set ListB to {}
repeat 10000 times
set the end of ListB to "a"
end repeat
takes 23 seconds
Identical timing, which leads me to ask: "why does Paul say set is more
efficient than copy?"
Matt Strange
email@hidden
PS: the 'other' method of concatenating a list takes 48 seconds (twice
as long)...
set ListC to {}
repeat 10000 times
set ListC to ListC & "a"
end repeat
_______________________________________________
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.