Re: [xsl] How is memory allocated in recursive XSLT templates?

Subject: Re: [xsl] How is memory allocated in recursive XSLT templates?
From: "Rashmi Rubdi" <rashmi.sub@xxxxxxxxx>
Date: Wed, 2 May 2007 16:43:42 -0400
On 5/2/07, Abel Braaksma <abel.online@xxxxxxxxx> wrote:
Rashmi Rubdi wrote:
>
>
> Thanks a lot for the solution, I will try your code and see if I can
> compare the limits with 2 programming languages, just for the sake of
> curiosity.

Here's some fulfilling of curiosity ;)

The limit I found on my system was f:fac(472), where f:fac(473) raised
"Too many nested function calls. May be due to infinite recursion". This
was inside Eclipse. Outside Eclipse, the top appeared at f:fac(632) and
-Xss###k did not help anything, which makes me believe that the maximum
recursive depth is enforced by Saxon somehow.

It could be the memory space available to hold the longest number is limited, and not particularly the recursive depth. Although I could be wrong, because I know little.


Trying the same with AltovaXML showed a top of f:fac(999), where f:fac(1000) raised an error. AltovaXML has an /xslstack option, but that only seems to work with lower values, I can't seem to force it higher (which makes me wonder why the stack option is there in the first place).

(which proofs nothing, except perhaps that neither uses tail recursion
on this factorial function. Perhaps I should try it with templates and
see if the same depths are found...)

But reading your post further perhaps indicates the recursive depth. I still haven't tried this with Java yet, but will be working on it shortly --- soon as I finish understanding how to use BigInteger.

The most interesting result however was the speed: in all situations it
was blazingly fast (compile/run in < 1 sec)

-- Abel Braaksma

I have to read up on how to note the time in XSLT 2.0, will use Google for that.


-Regards
Rashmi

Current Thread