This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Recursive vs. tail-recursive functions
- To: Andrew Ho <andrew at tellme dot com>
- Subject: Re: Recursive vs. tail-recursive functions
- From: Dirk Herrmann <dirk at ida dot ing dot tu-bs dot de>
- Date: Thu, 8 Jun 2000 10:44:50 +0200 (MEST)
- cc: Guile Mailing List <guile at sourceware dot cygnus dot com>
On Wed, 7 Jun 2000, Andrew Ho wrote:
> So the other day I wanted to empirically find out what time savings this
> would have, so I wrote the following script to do some timing tests.
> The strange result seems to be that the simple recursive case is
> significantly faster than the tail-recursive case. What gives?
> Is there some secret under-the-hood optimization I'm unaware of?
This is just a guess: Are you using the debugging evaluator? If so, this
may be the reason, since I think that the debugging evaluator has to do
something clever in the context of tail recursive calls in order to
provide you with a valid backtrace. (Actually, I don't know at all how
the debugging evaluator handles tail calls, but it _might_ be a reason.)
Best regards
Dirk