• 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: Time in milliseconds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Time in milliseconds


  • Subject: Re: Time in milliseconds
  • From: "Dennis W. Manasco" <email@hidden>
  • Date: Sat, 31 Jul 2004 05:07:43 -0500

At 8:42 pm -0400 7/30/04, Paul Skinner wrote:

On Jul 30, 2004, at 5:40 PM, Paul Berkowitz wrote:

On 7/30/04 1:30 PM, "Paul Skinner" <email@hidden> wrote:

GetMilliSec
-->7.3012042E+7

<http://osaxen.com/modules.php?
op=modload&name=Downloads&file=index&req=getit&lid=112>

GetMilliSec is excellent, but it has the same Heisenberg-limitation that
simply calling an osax adds many milliseconds delay, so it won't in fact be
accurate.

set t1 to GetMilliSec
set r to 1000
repeat r times
GetMilliSec
end repeat
set t2 to (GetMilliSec)
(((t2 - t1) / r) as text) & "ms per call"
-->1.166ms per call


-->0.054ms per call

OMM, with repeats between .053 and .059 except for one jump to .064 and one jump to .075.

(Dual 1G G4 Spring 2002 OS X 10.2.8 running uncompiled from Script Editor 1.9.)

Pretty cool.

I assume GetMilliSec is returning/reading/calling uptime, but it's too late to do the math to be sure. Does anyone know the exact mechanism?

Is there any English documentation? When I open the ReadMe file it starts OS 9 and displays in Osaka; I think it must be in Japanese since there are credits at the bottom with .jp mail addresses.


-=-Dennis


Just to nit pick over something that bothered me about the original code, and should have no real effect on the result, shouldn't the last line be:

(((t2 - t1) / (r+2)) as text) & "ms per call" ?

(Though, for r = 1000, /r gives a much nicer looking result than /(r+2)...)


(Just for the heck of it)

set bigRes to 0
set bigLoop to 1000
repeat bigLoop times
set r to 1000
set t1 to GetMilliSec
repeat r times
GetMilliSec
end repeat
set t2 to (GetMilliSec)
set bigRes to (bigRes + ((t2 - t1) / (r + 2)))
end repeat
((bigRes / bigLoop) as text) & " ms per call"

--> 0.056177644711 ms per call

and that's with the little radioactive beach ball spinning...
_______________________________________________
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.


  • Follow-Ups:
    • Re: Time in milliseconds
      • From: Paul Skinner <email@hidden>
References: 
 >Re: Time in milliseconds (From: Paul Berkowitz <email@hidden>)
 >Re: Time in milliseconds (From: Paul Skinner <email@hidden>)

  • Prev by Date: Re: Time in milliseconds
  • Next by Date: Re: Time in milliseconds
  • Previous by thread: Re: Time in milliseconds
  • Next by thread: Re: Time in milliseconds
  • Index(es):
    • Date
    • Thread