This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: I need to learn more about optimizing my code
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] I need to learn more about optimizing my code
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Thu, 18 Oct 2001 09:41:25 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> I need to learn more about optimizing my code. Is there a
> website or book
> that has some depth on this? What kind of xpath statements are more
> processor intensive than others? What XSLT processors are
> the fastest?
> How much does the size of the XML file being read in factors
> into the time
> it takes to process the translation?
The two biggest factors are the size of the source XML file and the number
of times you visit each node. The difficult bit is that the processor may
optimize your expressions to reduce the number of node visits, for example
if you write
preceding-sibling::*[1]
then it will probably only visit the first preceding sibling, rather than
visiting them all and discarding all but the first. Of course different
processors have difference optimizations, which means that the performance
of something like
<xsl:if test="count(//item)=0">
may vary dramatically from one processor to another.
But the usual discipline applies: look for the most deeply nested loops,
remembering that loops can either be explicit (apply-templates or for-each),
or implicit in path expressions (a/b/c, or //a).
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list