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

Re: Re:Re: How to improve the performance where a key

Subject: Re: Re:Re: How to improve the performance where a key element used in multiple documents's
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Mon, 25 Jun 2001 09:17:01 +0100
Re:  Re:Re: How to improve the performance where a key
Hi Sun-fu,

> You specially suggest me to consider using predicates such as:
>
> <xsl:variable name="MSource" select="$originalDoc/z:row"/>
>   <xsl:apply-templates select="$MSource[@OrderNo = $thisNo]"
>                        mode="transDtl" />
>
> instead of using key element,
>
>     <xsl:for-each select="$originalDoc">
>       <xsl:apply-templates select="key('TransNo',$thisNo)"
>                            mode="transDtl"/>
>     </xsl:for-each>
>
> As matter of fact I have tried using predicates, however its
> performance is much slower compared with that of using key table. So
> I decide keep on using key function.

Cool - you're absolutely right to test whether any sweeping statements
about efficiency has a real effect in your particular case.

I think the reason that you're getting such a marked increase in speed
with the key is because in the code as you've given above, you're
using it in a very worthwhile way. I was specifically talking about
using a key *where the key was only used once on a particular
document*. The case that I discussed was where you were using a key on
an RTF that had just been created - you were creating several new RTFs
(one for each OrderNo) and then using a key on each of them just once.

In the case that you show above, on the other hand, you're using the
key on $originalDoc. Here, the key is also used on $originalDoc prior
to that, when you generate the $TransNoheading variable (set of unique
z:row elements). And the key is also used multiple times within the
xsl:for-each that's iterating over the OrderNos. So there, you're
using a key on the same document *multiple* times - it's not
surprising you get a marked increase in speed.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.