Re: Appending a list to a list and getting one list.
Re: Appending a list to a list and getting one list.
- Subject: Re: Appending a list to a list and getting one list.
- From: Mr Tea <email@hidden>
- Date: Tue, 14 May 2002 01:24:03 +0100
This from Paul Skinner - dated 13/5/02 05.40 pm:
>
References aren't a bit of help.
Hi, Paul. It's good to see that someone has been reading the ASLG, even if I
haven't ;>
I played with the script that you posted, finding various ways to add one
huge list to another, and got some contrasting results that I don't
understand the differences between (especially in the light of your quoted
comment).
set bigList to {}
set bigListRef to a reference to bigList
set numItems to 10000
set t to (time of (current date))
repeat with n from 1 to numItems
copy n to the end of bigListRef
end repeat
set newlist to {}
repeat with n from 1 to numItems
copy bigList's item n to end of newlist
end repeat
set total to (time of (current date)) - t
Total -->93
...which is in the same ballpark as the concatenation example in your post.
But if I changed the line in the second repeat loop to:
copy bigListRef's item n to end of newlist
...the time shrank to a considerably leaner 32 seconds, So using the
'reference' variable here clearly makes a difference. Is that expected? And
does this in any way address the question you asked? (I'm reaching a bit,
here.)
After taking a deep breath, I set newlist to bigList at the start of the
second repeat loop, just to give AS a bit of a kicking. Using bigListRef to
put the two sets of 10000 items in the same list took 94 seconds, and I'm
just going to test 'bigList' now while I go and put the kettle on...
What the hey! 93 again!? Same as before. Now I'm really confused. Bummer.
[More 'toddler-in-a-sandbox'-style testing ensues.]
Oh dear. I just tried building a 20000 item list by concatenating bigList
and newlist (after setting newlist to bigList).
set hugeList to biglist & newlist
With the time displayed as the final result, it came up as less than one
second (0), but with 'hugeList' as the final command in the script, Script
Debugger just flopped over and died. I think that means it's time for bed.
Mr Tea
_______________________________________________
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.