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.
- References:
- Expression timing; a black art?
- From: AES <siegman@stanford.edu>
- Expression timing; a black art?