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

RE: performance with template and choose

Subject: RE: performance with template and choose
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 12 Sep 2002 02:22:35 -0700 (PDT)
function template performance
--- "Michael Kay" <michael dot h dot kay at ntlworld dot com> wrote:

> 
> It looks as if MSXML3 isn't clever enough to spot that the different
> match patterns contain common subexpressions (e.g.
> 
> KH[@Type='401']/Key[@ProdID ='83' and translate(@StopVal, '-','')
> &lt;='20050911']
> 
> and so it is evaluating this subexpression several times for each
> candidate node. Your rewritten code avoids this by factoring out the
> subexpression so that there is a two-stage test.
> 
> Saxon won't do this optimization either, though in 7.2 I've started
> to
> put the logic in place to factor out common subexpressions.
> Interestingly, in Saxon 7.2 you could do this yourself with a memo
> function:
> 
> <xsl:template match="MD[z:type-1(.) and @ACPID='100']/@AAvl"
> > priority="1001" >
> 
> 
> <xsl:function name="z:type-1" saxon:memo-function="yes">
>   <xsl:param name="N"/>
>   <xsl:return select=boolean($N/parent::Key[@ProdID ='83' and
> translate(@StopVal, '-','')
> &lt;='20050911']/parent::KH[@Type='401'])"/>
> </xsl:function>
> 
> If a memo function is called twice with the same arguments, it
> remembers
> the result from the first time and avoids re-evaluating the function.


Wow.. Memoisation in XSLT! That's really great.

Mike, what exactly do you mean by "called twice with the same
arguments"?

For example, if the second time a corresponding argument is a different
node having the same string value (or which is "deep equal" to the
corresponding previous argument), will this be "the same argument" ?

Is there any reason (besides performance (side-effects)) why
memoisation should not be the default behaviour?



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________________________
Do you Yahoo!?
Yahoo! News - Today's headlines
http://news.yahoo.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.