Bug #5681


-TP:profile.html with transformations using fn:transform()

Added by Michael Kay over 1 year ago. Updated 12 months ago.

Command Line
Start date:
Due date:
% Done:


Estimated time:
Legacy ID:
Applies to branch:
12, trunk
Fix Committed on Branch:
12, trunk
Fixed in Maintenance Release:


If a transformation is initiated with profiling using the -TP option on the command line, and the transformation uses fn:transform() to trigger sub-transformations, the profiling report can be difficult to interpret.

The report will be divided into sections, each one headed "Analysis of stylesheet execution time" and each one corresponding to one transformation. The data, however, is kept globally, and is not reset for each transformation, so the reports are cumulative; the actual numbers are therefore rather meaningless.


profile.html (7.36 KB) profile.html Len Schultz, 2022-09-23 03:02
Actions #1

Updated by Len Schultz over 1 year ago

I'm getting different results, at least when running profiling within eXist-db. I have run profiling on the command line in the past, and did notice sections with apparently meaningless numbers. However, the results I'm seeing now are just one section, with no data for the fn:transform().

Profile for this XSLT:

<xsl:variable name="pre" select="."/>
<xsl:variable name="xsl">pdfstyles/{$pre/winelist/@xsl}</xsl:variable>
<xsl:variable name="wqml" select="transform(map{'stylesheet-location':$xsl, 'source-node':$pre})?output"/>
<xsl:variable name="model" select="doc('/db/model.xml')"/>
Actions #2

Updated by Michael Kay about 1 year ago

I'm running a test. What's happening is this:

  • There is a single TimingTraceListener with a single dataset for the metrics shared by all the transformations
  • At the end of each transformation, TimingTraceListener.close() is called, and this triggers execution of the stylesheet to generate the profile report.
  • The metrics are then used to build an XML document which forms the input to the transformation. The metrics are not cleared after being displayed, so the successive displays (one for each transformation) show cumulative results
  • The HTML reports are all appended to the single output file; the browser is quite happy to display several HTML documents concatenated into a single file.

I propose to make only modest changes:

(a) The metrics should be reset after being displayed, so each transformation produces a table of results that relate to that transformation only

(b) The header information in the output report should enable the transformations to be distinguished.

Actions #3

Updated by Michael Kay about 1 year ago

I've implemented this; the changes were a bit more extensive. In particular, it's not enough to clear the metrics after display, because there is actually a stack of transformations invoked using fn:transform(), not a linear sequence; so we maintain a stack of metric collections for each active transformation. The formatting stylesheet has been adapted to show the URI of the stylesheet, the start time, and an indication of whether it's an fn:transform() transformation. Note that the tables are in order of stylesheet completion, so the outermost stylesheet is displayed last.

This is done on the 12.x branch and I'm not proposing to retrofit it to 11.x.

Actions #4

Updated by Michael Kay about 1 year ago

  • Category set to Command Line
  • Status changed from New to Resolved
  • Applies to branch 12, trunk added
  • Fix Committed on Branch 12, trunk added
  • Platforms Java added
Actions #5

Updated by O'Neil Delpratt 12 months ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 12.1 added

Bug fix applied in the Saxon 12.1 maintenance release.

Please register to edit this issue

Also available in: Atom PDF