Re: Ron Knapp's time function
- To: mathgroup at smc.vnet.net
 - Subject: [mg24558] Re: Ron Knapp's time function
 - From: "Allan Hayes" <hay at haystack.demon.co.uk>
 - Date: Mon, 24 Jul 2000 03:04:39 -0400 (EDT)
 - References: <8kjehf$e6o@smc.vnet.net>
 - Sender: owner-wri-mathgroup at wolfram.com
 
This may be what you want:
time::usage = "time[expr_] finds the number of seconds,t, taken to evaluate
Do[expr,{2^n}]] for n=0,1,2,..., until t >= 1.0; it then returns the  t/
2^n.
SetAttributes[time, HoldAll];
time[expr_] :=
  Module[{t = Timing[expr;][[1, 1]], n = 1},
    While[t < 1.,
      t = Timing[Do[expr, {n *= 2}]][[1, 1]]
      ];
    t/n  Second ]
--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"fkampas" <fkampas at email.msn.com> wrote in message
news:8kjehf$e6o at smc.vnet.net...
> Does anybody have the Mathematica code
> for the generalized timing function that Ron
> Knapp presented at the last developer's
> conference?  It isn't given in his notebooks
> in the conference section on the Wolfram
> web site.
>
>
>
>