|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: performance with template and choose
--- "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, '-','') > <='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, '-','') > <='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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








