MathGroup Archive 2005

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

Search the Archive

Re: Expression timing; a black art?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63259] Re: [mg63234] Expression timing; a black art?
  • From: ggroup at sarj.ca
  • Date: Tue, 20 Dec 2005 23:35:43 -0500 (EST)
  • References: <200512200919.EAA28501@smc.vnet.net>
  • Reply-to: ggroup at sarj.ca
  • Sender: owner-wri-mathgroup at wolfram.com

On Tuesday, December 20, 2005 at 04:19 GMT -0500, Aes wrote:

> Approach: Create a notebook with three sections, each of the form:

>    x; Remove["Global`*"];
>    fn :=  (function as below)
>    a=0.12; xmax=3.5; dx=0.1;
>    tn=Timing[Table[{x, fn[a,x]//N}, {x,0,xmax,dx}]]; 
<snip>
> Conclusion #1:  Running *either* f1 or f2 once leaves something (?) in
> the kernel that greatly speeds up the f2 or f1, and gives a little help 
> to f3.  Running f3 first gives a little help to f2 (30 down to 20), and 
> probably also to f1 (didn't try), but doesn't push it all the way down 
> to 5.

You can reduce this effect by adding the Developer`ClearCache[]
command to each of your sections.  From the help:

ClearCache[ ] clears internal caches of stored results.
ClearCache is useful if one needs to generate worst-case timing
results independent of previous computations.




  • Prev by Date: "Alternating" function
  • Next by Date: Re: Re: Replacement equivalence?
  • Previous by thread: Expression timing; a black art?
  • Next by thread: Re: Expression timing; a black art?