[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: problem: recursive templates slowing xalan process

Subject: Re: problem: recursive templates slowing xalan processor down
From: Brian Chrisman <brian.chrisman@xxxxxx>
Date: Tue, 11 May 2004 10:36:21 -0700
xalan tail recursion
Jeni Tennison wrote:


Finally, and this is the most important rewrite, it's much better to write a recursive template as a tail-recursive template if you can (or as a divide-and-conquer template if there are hundreds of recursions involved each time the template is called). A tail-recursive template calls itself as the very last thing that it does. You need to have an extra parameter to keep track of the current sum, and update this parameter on each recursion. Here's what your template looks like when it's rewritten using the advice above and as a tail-recursive template:




I read in another post that tail recursion performs better because internally some processors convert it from recursion to looping. Are there other reasons processors fare better with tail recursion as well?


Thanks,
Brian

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.