[AIX HP-UX Linux Solaris Windows]This topic applies only on the z/OS operating system.

Performance tips

Follow these tips to improve performance when using XPath, XQuery, and XSLT.

Table 1. Performance tips.

Follow these tips to improve performance.

Language Tip
XPath Using // can be an expensive operation. Making the path more explicit (a/b/c rather than a//c) can improve performance. This is especially important when the path starts at or near the root of a large document.
The last() function, because it requires fully evaluating the sequence to count the items, can be an expensive operation.
Positional predicates with constant values, such as [3], are usually more efficient than those with values that are computed or that are retrieved from variables.
XSLT Parameters are slower to access than variables. If you do not need to supply the value of the parameter externally, use a variable.
Using xsl:key elements and the key() function can be an efficient way to retrieve node sets.
Pattern matching and apply-templates dispatch are usually faster than the xsl:if or xsl:when statements.
Positional predicates in match patterns are usually expensive.
In general, simpler match patterns such as "address" are less expensive to process than complicated ones such as "/purchaseorder/shipping/customer/postal/address". Take advantage of your knowledge of the document's structure and your stylesheet's behavior to avoid unnecessarily overspecifying.
For some data models, the xsl:skip-space operation must be applied during document navigation rather than during document load. This can add some execution-time overhead.
Consider calling the registerImportedSchemas method on the XSLTExecutable instance if the stylesheet imports one or more schemas and the same stylesheet will be executed more than once. If registerImportedSchemas is not called, the imported schemas will be loaded every time one of the execute methods is called. By default, imported schemas can only be used to validate result trees; but calling this method has the same effect as registering the schemas with the XFactory, which means that they will be used to validate input documents.
XPath, XQuery, and XSLT Decoding and encoding is expensive. Generally, UTF-8 and UTF-16 can be read and written more quickly than other encodings.
XQuery Consider calling the registerImportedSchemas method on the XQueryExecutable instance if the query imports one or more schemas and the same query will be executed more than once. If registerImportedSchemas is not called, the imported schemas will be loaded every time one of the execute methods is called. By default, imported schemas can only be used to validate result trees; but calling this method has the same effect as registering the schemas with the XFactory, which means that they will be used to validate input documents.



Concept topic    

Terms of Use | Feedback

Last updated: Oct 21, 2010 1:06:41 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=v700xml&product=was-nd-mp&topic=cxml_perf_tips
File name: cxml_perf_tips.html