Subject: Re: [xsl] How is memory allocated in recursive XSLT templates? From: "Rashmi Rubdi" <rashmi.sub@xxxxxxxxx> Date: Wed, 2 May 2007 23:35:37 -0400 |
I want just to add something to this very interesting discussion.
In all cases when it is difficult to come up with a tail-recursive transformation, or the XSLT processor in use happens not to recognize the particular kind of tail recursion used (as happened with my example that became the base for the thread in the saxon-help list), then there is usually the possibility to use a DVC (DiVide and Conquer) approach.
Very briefly described, a DVC algorithm typically processes two or more (shorter) parts of the input list (recursively!) and then combines the results.
Thus, processing a list of 1 000 000 (1M) elements with DVC will require a maximum call-stack depth of only 19 (~ log2(1000000) ),
One can read more about DVC algorithms for example in Robert Sedgewick's book "Algorithms in C++".
We were taught the DVC algorithm in school, I plan to get Donald Knuth's books http://en.wikipedia.org/wiki/Art_of_Computer_Programming
Most of the functions of FXSL, which are defined to process long lists, have a DVC equivalent.
I was looking at some of the functions in FXSL like Fibonacci, it's written very elegantly - as soon as I learn those concepts I will understand whats in there but thank you for the encouragement.
A lot of valuable things were taught in school , I wish I had saved my books , now I don't even remember what books were used. I've gotta track them down somehow.
-- Cheers, Dimitre Novatchev
-Regards Rashmi
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How is memory allocated i, Dimitre Novatchev | Thread | [xsl] make it single line, Senthilkumaravelan K |
Re: [xsl] How is memory allocated i, Dimitre Novatchev | Date | [xsl] make it single line, Senthilkumaravelan K |
Month |