Re: [xsl] bad programming for speedup?

Subject: Re: [xsl] bad programming for speedup?
From: Justin Johansson <procode@xxxxxxxxxx>
Date: Tue, 24 Jul 2007 20:07:38 +0900
Hi Christoph,

>What are you thinking, is it allowed to discard the rules of good 
>programming for speed-up desires?

IMHO, You need to justify what you already know is "bad" XSL
style by demonstrating that

1)  Your "bad" solution will be used very often in a performance-
challenged, or runtime-speed-is-critically-important, system.

2) Your "bad" solution should exhibit an order of magnitude
better performance than the "good" XSL solution, and, that,
would be a surprise to me if that were to be the case.

If 1) is the case and the XSL performance is so poor for your
demaining requirements, then perhaps it would be better to
develop a non-XSL program to achieve the desired result using,
say, a SAX reader/filter approach to do the transform in a
conventional high-level language such as C++ or Java.

BTW.  I doubt that what you have in the "bad" solution, namely

	<xsl:if test="name(preceding-sibling::*[1]) != 'row'">
and
	<xsl:if test="name(following-sibling::*[1]) != 'row'">

is buying you anything much in the way of speed up.

Those tests, in themselves, could be better written as

	<xsl:if test="not( preceding-sibling::*[1][self::row])">
and
	<xsl:if test="not( following-sibling::*[1][self::row])">

respectively.

Of course, others on this list may offer a more insightful response
and/or disagree with me.

Justin Johansson
Australia

Current Thread