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

Re: Will Saxon 9 optimize or cache this so performance

Subject: Re: Will Saxon 9 optimize or cache this so performance doesn't degrade?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Tue, 05 Feb 2013 09:31:17 +0000
Re:  Will Saxon 9 optimize or cache this so performance
With optimization, it all depends....

You won't get any indexing optimizations. Those are done only for equality predicates, not for contains().

If $map is a global variable, then Saxon-EE will recognize this as an expression that depends only on global variables, and turn it into a global variable itself. Or at least it will if you remove the requirement to create a new copy of the nodes each time it's evaluated: change it to

<xsl:variable name="topicChapters" select="$map//*[contains(@class, ' bookmap/chapter ')]
              union $map//*[contains(@class, ' bookmap/appendix ')]
              union $map//*[contains(@class, ' bookmap/preface ')]"/>


unless for some reason you really want a fresh copy to be made each time.


But if $map is local, no such luck. Your best bet then would be to turn it into a memo function.

Michael Kay
Saxonica


On 05/02/2013 01:43, Steve Fogel wrote:
Hi, all...

I've got a PDF customization template that gets called maybe a couple of dozen
times during the processing of a DITA bookmap. It has the following code in it:

       &lt;xsl:variable name="topicChapters">
	   &lt;xsl:copy-of select="$map//*[contains(@class, ' bookmap/chapter ')]
               union $map//*[contains(@class, ' bookmap/appendix ')]
               union $map//*[contains(@class, ' bookmap/preface ')]"/>
       &lt;/xsl:variable>

This code will have to scan a good deal of the XML tree document represents the book. The
document will not change between each execution of the template.

Will Saxon optimize/cache this and not calculate it each time? I can always set
this variable in a parent template (that executes only once) and pass it into
this one. For readability however, it makes more sense to have this variable
where it is.

Thanks

Steve




Steve Fogel | Information Architect, Oracle Database | 650.506.4914 Oracle Server Technologies Information Development 500 Oracle Parkway | M/S 4op1126 | Redwood Shores, CA 94065

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.