• 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
Re: Dice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dice


  • Subject: Re: Dice
  • From: Malcolm Fitzgerald <email@hidden>
  • Date: Wed, 27 Oct 2004 17:36:10 +1000


Not bad, if there were not some item! :)


kai wrote:


Hm... 'some paragraph' has the edge OMM - although my test differs from yours somewhat.


On Oct 27, 2004, at 1:55 AM, Malcolm Fitzgerald wrote:

I used 1000 items, characters, words, paragraphs, etc and repeated 1000 times to get these two sets of results from Smile's chrono on a G4 400.
....Paragraph is a strong performer but it is slower than random number here and they are both left in the dust by character.

Joseph Weaks wrote:

And I am getting even differenter results picking randomly from a set of ten repeating a million times as per this handler:

on doIt(theSet)
set t1 to current date
if theSet = "" then
repeat 1000000 times
set x to random number from 1 to 10
end repeat
else if class of theSet is string then
repeat 1000000 times
set x to some paragraph of theSet
end repeat
else if class of theSet is list then
repeat 1000000 times
set x to some item of theSet
end repeat
else
return "huh?"
end if
set t2 to current date
return (t2 - t1)
end doIt

You are doing a lot more inside the timing routine than I am. That could have an effect. Also I'm using a different and more finely tuned instrument than current date. This is how I set up the test.


-- chrono requires satimage osax

set n to 1000
set nList to {}
repeat with i from 1 to n
	set end of nList to i
end repeat


set my text item delimiters to "" set someChars to text 1 thru n of (nList as string) set my text item delimiters to " " set someWords to nList as string set my text item delimiters to return set someParas to nList as string

set t0 to chrono
repeat n times
	get random number from 1 to n
end repeat
set t1 to chrono
repeat n times
	get some item of nList
end repeat
set t2 to chrono
repeat n times
	get some character of someChars
end repeat
set t3 to chrono
repeat n times
	get some word of someWords
end repeat
set t4 to chrono
repeat n times
	get some paragraph of someParas
end repeat
set t5 to chrono

get {mfRandom:t1, mfItem:t2, mfCharacter:t3, mfWord:t4, mfParagraph:t5}


-- Malcolm Fitzgerald phone: 02 9318 0877 Database Manager fax: 02 9318 0530 The Australian Society of Authors <http://www.asauthors.org> _______________________________________________ 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
  • Follow-Ups:
    • text item delimiters
      • From: David Andrews <email@hidden>
References: 
 >Re: Dice (From: kai <email@hidden>)
 >Re: Dice (From: Malcolm Fitzgerald <email@hidden>)
 >Re: Dice (From: Joseph Weaks <email@hidden>)

  • Prev by Date: Re: Dice
  • Next by Date: Re: applescript's text item delimiters
  • Previous by thread: Re: Dice
  • Next by thread: text item delimiters
  • Index(es):
    • Date
    • Thread