Mark-Jason Dominus <mjd@plover.com> wrote: > > But the following example does > > not seem to show the hope-for speedup of tail recursion: > > >In any case, I'm pretty sure we have had this conversation already. >You don't get a time optimization because goto & has large overhead. >See http://www.plover.com/~mjd/misc/tail-recurse.pl for example. > It may have been talked about, but I was not part of it. > > > The slowness then characteristic speedup as @_ shrinks > > indicates that tail recursion is not happening. > >It's not really clear what you mean by 'tail recursion is not >happening'. The conclusion I would draw from this is that the goto-& >operation is copying or relocating the argument vector, or performing >some other operation that is O(n) in the size of the argument vector. >But the stack remains constant size, as you can see from a perl -Ds >trace. > Sorry, I meant that I had hoped Perl would be able to use this optimization and run quickly like a loop does. But yes, memory usage is contained for me. (Though a friend who ran under 5.6.0 claimed it didn't for him, I will have to test that tonight.) Ben _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.comThread Previous | Thread Next