# 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 sends timed tracing information to the specified file (or to the standard error output if no filename is given)

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

Then run another transformation to create a profile report from the output of this tracing tool (the stylesheet can be found in the directory `samples/analysis`, installed from the `saxon-resources` download collection.):

java -jar dir/saxon9he.jar profile.xml timing-profile.xsl >profile.html

Finally, view the resulting `profile.html` file in your browser.

The output identifies instructions in the original stylesheet by their name, 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. The table is sorted according to a weighting function that attempts to put the dominant instructions 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.

Next