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

RE: Performance Tuning

Subject: RE: Performance Tuning
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Wed, 10 Nov 2004 17:17:34 -0000
xsl performance tuning
> > The XSL that I use has  three "preceding-sibling::"
> > The time taken to parse a 150KB XML in Xalan is 1.9
> > sec and with Saxon8 its 1.6 secs.
> >
> > Since the above parsing is done frequently in my
> > application with different input XMLs. I need to
> > further reduce the transformation timing (in
> > milliseconds may be). The only bottleneck I see are
> > the 3 preceding-sibling. Can we somehow remove them
> > or
> > use some other logic, to reduce my transformation
> > time.

Rather than walk the preceding-sibling axis many times, why not perform
a single pass in a global variable and then key into that for the
positions:

So, the top-level variable:

<xsl:variable name="parentGroup">
  <xsl:for-each select="ParentGroup">
    <parentgroup id="generate-id()" pos="position()"/>
  </xsl:for-each>
</xsl:variable>

And the key:

<xsl:key name="parentGroups" match="ParentGroup" use="@id"/>

Then, instead of using count(preceding-sibling::ParentGroup), use:

<xsl:value-of select="key('parentGroups', generate-id())/@pos"/>

Remember you will need to change the context node to $parentGroup before
using the key.

If you do this, please post back any changes in performance.

cheers
andrew

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.