This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Updated Benchmark Available
- To: xsl-list at mulberrytech dot com
- Subject: Re: Updated Benchmark Available
- From: uche dot ogbuji at fourthought dot com
- Date: Thu, 19 Oct 2000 23:20:02 -0600
- Reply-To: xsl-list at mulberrytech dot com
>
> > 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@fourthought.com +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