Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Expression timing; a black art?

  • To: mathgroup at
  • Subject: [mg63259] Re: [mg63234] Expression timing; a black art?
  • From: ggroup at
  • Date: Tue, 20 Dec 2005 23:35:43 -0500 (EST)
  • References: <>
  • Reply-to: ggroup at
  • Sender: owner-wri-mathgroup at

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}]]; 
> 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?