Re: Determining item number matching "x" in a list
Re: Determining item number matching "x" in a list
- Subject: Re: Determining item number matching "x" in a list
- From: Emmanuel <email@hidden>
- Date: Fri, 14 Mar 2003 18:50:09 +0100
At 11:47 AM -0500 14/03/03, Steve Cunningham wrote:
Emmanuel wrote
NG's "getindex" requires 170 +or- 25 microseconds
>My "IndexOfItem" requires 809 +or- 37 microseconds
I can't reproduce these results :-( I don't mean absolutely, but
relatively.
[...]
Seems like while our absolute times will certainly be different, the
relative rankings should be the same.
Sure. Unfortunately I trashed the testing program. I'll pseudo-write it here:
(theList should contain 20 short strings)
----------------------------------- off the top of my head
set {theXs, theYs} to {{},{}}
repeat with theItem in theList
set theItem to contents of theItem
chrono
repeat 100 times
getindex(theItem, theList)
end repeat
set end of theXs to chrono
chrono
repeat 100 times
IndexOfItem(theItem, theList)
end repeat
set end of theYs to chrono
end repeat -- theIndex in theList
set theXs to item 1 thru -2 of sort (theXs) -- eliminate largest
set theYs to item 1 thru -2 of sort (theYs)
msg(display(statlist(multlist theXs with 10000))) -- /100 repeats x
1,000,000 microseconds/second
msg(display(statlist(multlist theYs with 10000)))
-----------------------------------
Emmanuel
_______________________________________________
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.