[plt-scheme] recursion and efficiency?!

From: Manfred Lotz (manfred.lotz at web.de)
Date: Wed Apr 21 13:40:01 EDT 2004

On Wed, 21 Apr 2004 11:29:23 -0400
Matthias Felleisen <matthias at ccs.neu.edu> wrote:

> See HtDP  
> (http://www.htdp.org/2003-09-26/Book/curriculum-Z-H 
> -39.html#node_sec_31.3).
> 
> Nutshell: (1) Tail-call optimizations are about saving space not time.
>  

Hmmh, I see. Didn't know that. 


> (2) Converting
> from plain recursion to tail-call optimizations often reverses the  
> order of operations
> for beginners. In your case, big num arithmetic immediately dominates 
> 
> the calculations.

I naively thought that because there is big num arithmetic in all
three versions it would be pretty much the same from that point of
view.

> And then there might be Jens's effect. Small benchmarks often pollute 
> 
> caches and things
> with garbage.
> 

I ran each of fact1, fact2 and fact3 separately in a script from the
command line just to make sure there is no garbage collection from
any previous activities faking the result. 


-- 
Thanks,
Manfred




Posted on the users mailing list.