Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Re: Re: Re: Re: Pure Perl tail call optimization

by pdcawley (Hermit)
on Mar 19, 2004 at 21:19 UTC ( #338178=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re: Re: Pure Perl tail call optimization
in thread Pure Perl tail call optimization

You'll note that the original subject was 'Tail call optimization' not 'Tail recursion optimization'. Tail call optimization comes in handy even when you're not recursing. It comes in handy when you're using lots of simple methods that simply return the results of a simple function call

package LeafNode; ... sub accept { my($self, $visitor) = @_; $visitor->visit_leaf($self); }
When you have tail call optimization in place, visit_leaf can return directly to accept's caller('s caller's caller's ...). Even without recursion, this can be a win because stack frames can be costly to create.


Comment on Re: Re: Re: Re: Re: Pure Perl tail call optimization
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://338178]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2014-08-20 12:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (113 votes), past polls