Performance Analysis

Saxon comes with a simple tool allowing profiling of the execution time in a stylesheet.

To run this tool, first execute the transformation with the -TP:filename option, which will gather timed tracing information and create a profile report to the specified file (or to the standard error output if no filename is given)

java   -jar   dir/saxon9he.jar   -TP:profile.html   source   stylesheet

Then view the resulting profile.html file in your browser.

The output identifies templates and functions in the original stylesheet by their name or match pattern, line number, and the last few characters of the URI of their module. For each instruction it gives the number of times the instruction was executed, the average time in milliseconds of each execution, and the total time. Timings are given both gross (the time for a template including all the templates it calls recursively), and net (the time in a template excluding time in its called templates). The table is sorted according to a weighting function that attempts to put the dominant functions and templates at the top. These will not necessarily be those with the greatest time, which tend to be instructions that were only executed once but remained active for the duration of the transformation.