[4suite] RE: XSL Performance (fwd)
Uche Ogbuji
uogbuji at fourthought.com
Sun Jun 11 10:09:08 MDT 2000
Here is a very useful set of guidelines from the inestimable Mike Kay whose
book I've already lauded here.
I hope it is useful.
--Uche
------- Forwarded Message
Return-Path: <owner-xsl-list at mulberrytech.com>
Received: from mail.fourthought.com
by localhost with IMAP (fetchmail-5.3.1)
for uogbuji at localhost (single-drop); Fri, 02 Jun 2000 08:55:13 -0600 (MDT)
Received: from web1-1.ability.net (root@[216.32.69.6])
by yen.fourthought.com (8.9.3/8.9.3) with ESMTP id GAA32599;
Fri, 2 Jun 2000 06:04:12 -0600
Received: from mulberrytech.com
by web1-1.ability.net (8.9.3/8.9.1) with ESMTP id HAA28634 Fri, 2 Jun 2000
07:54:49 -0400 (EDT)
Received: (from majordom at localhost)
by mulberrytech.com (8.8.5/8.8.5) id HAA28632
Fri, 2 Jun 2000 07:54:49 -0400 (EDT)
Message-ID: <93CB64052F94D211BC5D0010A800133101FDEDC6 at wwmess3.bra01.icl.co.uk>
From: Kay Michael <Michael.Kay at icl.com>
To: "'xsl-list at mulberrytech.com'" <xsl-list at mulberrytech.com>
Subject: RE: XSL Performance
Date: Fri, 2 Jun 2000 12:47:46 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)
Content-Type: text/plain;
charset="iso-8859-1"
Sender: owner-xsl-list at mulberrytech.com
Precedence: bulk
Reply-To: xsl-list at mulberrytech.com
> There hasn't really been an answer to this question yet.
> > Are there any sites that discuss XSL's performance as it
> pertains to the XSL code.
The simple answer to the question is "no, there aren't". But here's a quick
attempt to fill the gap, all suggestions for enhancements are welcome.
Eight tips for how to use XSLT efficiently:
1. Keep the source documents small. If necessary split the document first.
2. Keep the XSLT processor (and Java VM) loaded in memory between runs
3. If you use the same stylesheet repeatedly, compile it first.
4. If you use the same source document repeatedly, keep it in memory.
5. If you perform the same transformation repeatedly, don't. Store the
result instead.
6. Keep the output document small. For example, if you're generating HTML,
use CSS.
7. Never validate the same source document more than once.
8. Split complex transformations into several stages.
Eight tips for how to write efficient XSLT:
1. Avoid repeated use of "//item".
2. Don't evaluate the same node-set more than once; save it in a variable.
3. Avoid <xsl:number> if you can. For example, by using position().
4. Use <xsl:key>, for example to solve grouping problems.
5. Avoid complex patterns in template rules. Instead, use <xsl:choose>
within the rule.
6. Be careful when using the preceding[-sibling] or following[-sibling]
axes. This often
indicates an algorithm with n-squared performance.
7. Don't sort the same node-set more than once. If necessary, save it as a
result tree fragment
and access it using the node-set() extension function.
8. To output the text value of a simple #PCDATA element, use <xsl:value-of>
in preference
to <xsl:apply-templates>.
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
------- End of Forwarded Message
More information about the 4suite
mailing list