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

Subject: Re: [xsl] How is memory allocated in recursive XSLT templates?
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 02 May 2007 22:36:38 +0200
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.

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...)

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

-- Abel Braaksma

Current Thread