This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Recursive vs. tail-recursive functions


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]