MathGroup Archive 1992

[Date Index] [Thread Index] [Author Index]

Search the Archive

speedups and fpu calls


>You would be suprised at the spped up with a FPU.  Most of the MMa stuff is
>floating point.  There is a big win.
> 
>
>       Kent

=========================================


it is also worth avoiding  fpu calls when possible.


y = {0,P1/2,Pi,3Pi/2};
z = N[{Sin[0],Sin[Pi/2],Sin[Pi],Sin[3Pi/2]}];
x := Random[Integer,{1,4}]

SeedRandom[1]
Timing[Table[Sin[y[[x]]],{5}]]
{0.0166667 Second, {-1, 0, 0, 0, 0}}

SeedRandom[1]
Timing[Table[z[[x]],{5}]]
{0.0166667 Second, {-1., 0, 0, 0, 0}}

SeedRandom[1]
Timing[Table[Sin[y[[x]]],{10000}];]
{18.1667 Second, Null}

SeedRandom[1]
Timing[Table[z[[x]],{10000}];]
{12.5333 Second, Null}

SeedRandom[1]
Timing[Table[Sin[y[[x]]],{50000}];]
{91.3667 Second, Null}

SeedRandom[1]
Timing[Table[z[[x]],{50000}];]
{62.3667 Second, Null}
richard j. gaylord, university of illinois, gaylord at ux1.cso.uiuc.edu

"if you're not programming functionally, then you're programming
dysfunctionally"






  • Prev by Date: Mie scattering
  • Next by Date: Re: Unions
  • Previous by thread: Re: Mie scattering
  • Next by thread: Solving eigenvalue problems for ode's