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: Thu, 3 May 2007 17:40:22 -0400
On 5/3/07, Michael Kay <mike@xxxxxxxxxxxx> wrote:
>
> I think I would prefer an extension function within the XSLT
> itself rather than from the command line, because then I
> would be able to note the time immediately before and after
> the function in question.

If you're using Saxon, the best way of getting fine-grained instrumentation
is to use the TimerTraceListener, which can be activated using -TP from the
command line.

I tried the -TP option, it provides a lot more useful analysis information than I imagined. It is especially useful to see the timing analysis for each function call itself.

I tried

java -Xss16384k -jar c:\dev\saxonb8-9-0-3j\saxon8.jar -it mainTemplate
-TP recursion.xsl 2>profile.xml

java -jar c:\dev\saxonb8-9-0-3j\saxon8.jar profile.xml
timing-profile.xsl >profile.html

and saw a nice summary of the timing analysis in profile.html

In my case since I tried to calculate the factorial of 10450 , the
profile.xml was about 1MB, this of course is because of the huge
number of nested function calls. I  find the breakdown of each
functions time made possible by Saxons -TP option quite useful.

Then I lowered the parameter to factorial of 10, and observed that the
function calls are nested inside profile.xml , which makes is useful
to trace how they're called.

This writes a file containing timing information; there's a
stylesheet called analyze.xsl in the samples folder which allows you to
summarize this information and determine how much time was spent in each
template or function.

Java's timing information is not very precise; you will only get meaningful

Yes, I guess it varies because the garbage collection of objects happens at random.

To me it is not important to calculate the time precisely,
nevertheless it is useful to know the fact.

figures for a template or function that's executed several hundred times.

Details at
http://www.saxonica.com/documentation/using-xsl/performanceanalysis.html

I haven't fully explored Saxon, I meant to do my homework, but thank you for pointing this out.

Michael Kay
http://www.saxonica.com/

-Regards Rashmi

Current Thread