Re: Performance question

Subject: Re: Performance question
From: "Larry Mason" <Larry_Mason@xxxxxx>
Date: Mon, 21 Jun 1999 13:44:16 -0500

A big thanks to James on determining the performance bottleneck.  Here is a
recap and resolution.

The XSL invokes a template to set the background color for each HTML table row.
The XML data has 2283 rows.  The template has one parameter, an indication of
the row's position, in order to determine if it is an evenly numbered row or
not.  Odd numbered rows are given one color and even numbered another.

Given this calculation of computing the parameter, the time to process was 9.1
seconds.
    <xsl:call-template name="start_row">
      <xsl:param name="depth"><xsl:number level="single" count="/data/*"
format="1"/>
   </xsl:param>

Given this calculation, the time is 3.3
    <xsl:call-template name="start_row">
      <xsl:param name="depth"><xsl:value-of select="position()"/></xsl:param>
   </xsl:param>

The tempalte itself:
  <xsl:template name="start_row">
    <xsl:param-variable name="depth">2</xsl:param-variable>
          <xsl:choose>
            <xsl:when test="$depth mod 2">
              <TR bgcolor="{$my_stripe_even}"/>
            </xsl:when>
            <xsl:otherwise>
              <TR bgcolor="{$my_stripe_odd}"/>
            </xsl:otherwise>
          </xsl:choose>
  </xsl:template>

Bear in mind lots of other XSL processing is occuring, this is simply showing
the difference between 2 methods of
producing a value for the parameter and the corresponding delta in processing
time.

According to James the degradation is due to xsl-number.  By using another
approach that yields the same value,
the performance issue has been resolved.

Thought I'd share this find with others who may have similar needs.

Regards,
Larry



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread