[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

performance with template and choose

Subject: performance with template and choose
From: "Kimberly Hahn" <Kimberly.Hahn@xxxxxxxxxx>
Date: Wed, 11 Sep 2002 16:19:46 -0500
performance test template
I have a transformation that takes roughly 2.8 sec to run (using MSXML).  I
made some changes to it, moving some of the template matches into a choose
within a broader template.  This change was made for functional reasons, but
it cut the transformation time down to 1.4 sec.  I was just curious if
someone could shed light on why there was the performance improvement.

Sample differences:
slower version was structured as -
<xsl:template match="KH[@Type='401']/Key[@ProdID ='83' and
translate(@StopVal, '-','') &lt;='20050911']/MD[@ACPID='100']/@AAvl"
priority="1001" >
<xsl:attribute name="AAvl">1</xsl:attribute>
</xsl:template>
<xsl:template match="KH[@Type='401']/Key[@ProdID ='83' and
translate(@StopVal, '-','') &lt;='20050911']/MD[@BCPID='100']/@BAvl"
priority="1002" >
<xsl:attribute name="BAvl">1</xsl:attribute>
</xsl:template>
<xsl:template match="KH[@Type='401']/Key[@ProdID ='83' and
translate(@StopVal, '-','') &lt;='20030911']/MD[@ACPID='10']/@AAvl"
priority="1003" >
<xsl:attribute name="AAvl">1</xsl:attribute>
</xsl:template>
<xsl:template match="KH[@Type='401']/Key[@ProdID ='83' and
translate(@StopVal, '-','') &lt;='20030911']/MD[@BCPID='10']/@BAvl"
priority="1004" >
<xsl:attribute name="BAvl">1</xsl:attribute>
</xsl:template>
<xsl:template match="KH[@Type='401']/Key[@ProdID ='83' and
translate(@StopVal, '-','') &lt;='20030311']/MD[@ACPID='3']/@AAvl"
priority="1005" >
<xsl:attribute name="AAvl">1</xsl:attribute>
</xsl:template>
<xsl:template match="KH[@Type='401']/Key[@ProdID ='83' and
translate(@StopVal, '-','') &lt;='20030311']/MD[@BCPID='3']/@BAvl"
priority="1006" >
<xsl:attribute name="BAvl">1</xsl:attribute>
</xsl:template>

faster version as -
<xsl:template match="KH/Key[@ProdID ='83']/MD/@AAvl" priority="1001">
<xsl:attribute name="AAvl">
<xsl:choose>
<xsl:when test="translate(ancestor::Key/@StopVal, '-','') &lt;='20030311'
and (parent::MD/@ACPID='3')">1</xsl:when>
<xsl:when test="translate(ancestor::Key/@StopVal, '-','') &lt;='20030911'
and (parent::MD/@ACPID='10')">1</xsl:when>
<xsl:when test="translate(ancestor::Key/@StopVal, '-','') &lt;='20050911'
and (parent::MD/@ACPID='100')">1</xsl:when>
</xsl:choose>
</xsl:attribute>
</xsl:template>
<xsl:template match="KH/Key[@ProdID ='83']/MD/@BAvl" priority="1001">
<xsl:attribute name="BAvl">
<xsl:choose>
<xsl:when test="translate(ancestor::Key/@StopVal, '-','') &lt;='20030311'
and (parent::MD/@BCPID='3')">1</xsl:when>
<xsl:when test="translate(ancestor::Key/@StopVal, '-','') &lt;='20030911'
and (parent::MD/@BCPID='10')">1</xsl:when>
<xsl:when test="translate(ancestor::Key/@StopVal, '-','') &lt;='20050911'
and (parent::MD/@BCPID='100')">1</xsl:when>
</xsl:choose>
</xsl:attribute>
</xsl:template>

All other things (other named templates and unrelated template matches) in
the XSL documents were unchanged.


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.