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

Is failed key-lookups very slow in Xalan-J 1.2?

Subject: Is failed key-lookups very slow in Xalan-J 1.2?
From: tra@xxxxxxxxxxxxxxx (Thorbjoern Ravn Andersen)
Date: Wed, 22 Nov 2000 11:04:22 +0100
pricekey
I am developing an XSLT-version of our current application in which we
need to render XHTML-documents representing products, where the prices
shown to the customer depends on the ACCESSCODE which is passed to the
style sheet as a parameter.

My question deals with the speed of the "key"-construction in Xalan
1.2 (which is the platform we use -- I need good arguments to switch
to e.g Saxon.   Speed might be a good argument)

My timings show that if I replace the key-lookup with an empty string,
my code runs in 0.5 seconds (overhead from other routines), and if my
key-function succeedes in all 66 cases for my sample file then it runs
in about 1.0 second.  Each key-lookup returns either 0 or 1 node.

If the key-function _fails_ in all 66 cases then it runs in 5.5
seconds, which is rather unfortunate, since this is the default setup
for unregistered users.

Narrowing the scope for the key-function with a xsl:for-each around,
did not help.

Could a kind soul help me understand why Xalan-J 1.2 behaves like
this?  Is there a way to circumvent it?


The XSLT-code follows.  The various constructions I have tried is
still there as comments.


<xsl:key name="price-for" match="VALUENUM" use="../PRICEKEY"/>

<xsl:template match="STIBO-PRICE">
  <xsl:variable name="value" select="concat(@value,',',$ACCESSCODE)"/>

  <!--  <xsl:for-each select="$database">
-->

    <xsl:variable name="price" select="key('price-for', $value)"/>
      <!--<xsl:variable name="price" select="''"/>-->
    <xsl:choose>
      <xsl:when test="string-length($price)=0"> 
        <xsl:value-of select="$PRICELESS"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$price"/>
      </xsl:otherwise>
    </xsl:choose>
    <!--      </xsl:for-each>
-->
</xsl:template>



The database section looks like

<html>
  <database ...>
    <table0 ....>
      <record0>
        <PRICEKEY>2360455,1,RSES</PRICEKEY>
        <VALUENUM>247</VALUENUM>
      </record0>
      <record0>
        <PRICEKEY>2360455,2,RSES</PRICEKEY>
        <VALUENUM>222</VALUENUM>
      </record0>
    ....
    </table0>
    <table1>... [other irrelevant stuff]
    ...
    </table1>
  </database>

  ... rest of XHTML-file
</html>

The database variable which I have experimented with (to narrow the
scope) is defined as

    <xsl:variable name="database" select="/html/database"/>




Thanks in advance,

-- 
  Thorbjørn Ravn Andersen                   "...sound of... Tubular Bells!"
  http://bigfoot.com/~thunderbear


 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.