[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Updated Benchmark Available
> > > The project's stylesheet makes heavy use of a tail recursive template. > > I presume you mean fully tail-recursive -- it's explicitly using > call-template to reinvoke itself, and doing no work thereafter. As you > said, your Lisp pseudocode example is cheating a bit by explicitly calling > (output) on the result of the recursion, so it isn't really tail-recursion; > to make it qualify, you'd need to have the body of your pseudocode generate > the output and have the recursion _only_ recurse. > > I haven't thought about XSLT in these terms. The concept seems plausable; > the trick is structuring the code to recognize and take advantage of it > without incurring significant overhead in other cases. Might be possible to > do that in a static optimizing pass before running the stylesheet. Hm. > > How common is tail recursion in XSLT? Ha, have you taken a look at the N-Queens and Sieve of Erastothenes stylesheets? Bit in all seriouness, tail recursion in XSLT is quite common. You'll be surprised how many tasks become quite recursive at an order that exceeds the tree depth of the source document. This is especially common when we XSLT sorts get ambitious and decide to code text-processing tasks in XSLT. This is why 4XSLT optimizes tail-recursion, as does Saxon, as Mike Kay pointed out. It also makes solving those 10x10 N-Queens problems a bit easier without running out of stack, eh? -- Uche Ogbuji Principal Consultant uche.ogbuji@xxxxxxxxxxxxxxx +1 303 583 9900 x 101 Fourthought, Inc. http://Fourthought.com 4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA Software-engineering, knowledge-management, XML, CORBA, Linux, Python XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|