Re: minimum function? (Modified by Simon Forster)
Re: minimum function? (Modified by Simon Forster)
- Subject: Re: minimum function? (Modified by Simon Forster)
- From: Axel Luttgens <email@hidden>
- Date: Wed, 06 Apr 2005 17:31:25 +0200
Simon Forster wrote:
[...]
On 6 Apr 2005, at 11:39, Nigel Garvey wrote:
[...]
Why do you create a script object to hold the list of numbers? Why
don't you access the list of number passed into the function directly?
If it's a speed thing, can you explain a but further?
Speed! Just a matter of speed...
One has a similar phenomenon with references to lists.
Try this one:
-- Prepare a list of 1000 items
set l to {}
repeat with i from 1 to 1000
copy i to end of l
end repeat
-- Do this 50 times:
-- access each list's item in turn, directly
set starttime to current date
repeat with j from 1 to 50
repeat with i from 1 to 1000
get item i of l
end repeat
end repeat
set endtime to current date
log endtime - starttime
-- Do this 50 times:
-- access each list's item in turn, through a reference to the list
set lref to a reference to l
set starttime to current date
repeat with j from 1 to 50
repeat with i from 1 to 1000
get item i of lref
end repeat
end repeat
set endtime to current date
log endtime - starttime
Here, on my box, this results in about a 12x speed increase...
Now, unless I'm wrong, a true explanation for this has never been provided.
Axel
_______________________________________________
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