Subject: Re: [xsl] XSLT Optimizer and Deployment From: Liam R E Quin <liam@xxxxxx> Date: Tue, 16 Nov 2010 18:36:20 -0500 |
On Tue, 2010-11-16 at 15:46 -0700, Karl Stubsjoen wrote: > I am writing an XSLT optimizer, basically stripping comments and extra > white-space from an XSLT document for production deployment. Have you measured the performance difference you get? Modern XSLT implementations (e.g. Saxon) already do quite a bit of optimization, at a much less superficial level. You're likely to get more mileage adding "as' attributes, replacing = by eq, and replacing // with explicit paths (depending on the XML input, and on the XSLT processor - some of those suggestions depend on using XSLT 2, but if you're on XSLT 1 from 1998, get with the programme here ;-) ) If you do decide to strip whitespace, make sure you don't do it inside xsl:text or inside templates containing text that's outside xsl:text elements. > My optimizer will perform a couple of additional steps: set default > parameter values for production, make sure logging and other debug > steps are disabled, and so on... That may make more sense, but again distinguish between setting default values because they're correct for an environment, turning off debugging (might want debugging in production, no?) and removing possibly-sensitive information. Generally, logging surrounded by <xsl:if test="$logBusinessDecisions">...</xsl:if> isn't going to slow thing down signficantly, and might be useful... In most cases I've seen, a small change in methods can give a much greater speedup (orders of magnitudes often) than removing spaces: e.g. using xsl:key to speed up access of frequently-used patterns, and checking code that uses idioms like // or preceding::* where not needed, as these can sometimes lead to O(n^2) or worse behaviour. Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org www.advogato.org
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT Optimizer and Deploy, Karl Stubsjoen | Thread | Re: [xsl] XSLT Optimizer and Deploy, Karl Stubsjoen |
Re: [xsl] XSLT Optimizer and Deploy, Karl Stubsjoen | Date | Re: [xsl] XSLT Optimizer and Deploy, Karl Stubsjoen |
Month |