Performance

Subject: Performance
From: Mike Engelhart <mengelhart@xxxxxxxxxxxxx>
Date: Fri, 10 Mar 2000 10:40:39 -0600
Hi -

I have a couple of simple questions regarding XSL coding "style" and it's
effect on performance.  Let's assume a DOM based API (I use Xerces right
now)

1)  Is the above sentence an issue - are there actually noticable
performance hits for doing certain XSL actions.  I have heard using "//" to
access descendants can be a penalty but are there other obvious "things one
should avoid".  If there are, is there a list of these or documentation that
describes them anywhere.

2) I have several web pages that are being created dynamically (using
Cocoon's XSP processor).  On all of them I have the following elements in my
XML (i.e., XSP)
<time name="starttime" selected="8A"/> <!-- these time elements change -->
<time name="endtime" selected="5A"/>
<!-- followed by a list of 24 timeitems used to fill in an HTML SELECT
object - these do not change -->
<timeitem>
  <value>6A</value>
  <name>6:00 am</name>
</timeitem>
<timeitem>
  <value>7A</value>
  <name>7:00 am</name>
</timeitem>
....snip....
<timeitem>
  <value>12P</value>
  <name>12:00 pm</name>
</timeitem>

Is it better for performance reasons to embed a complete list of 24
<timeitem> elements inside of each <time> element so I don't have to
backtrack in my XSL using syntax like this:
<!-- XSL TEMPLATES -->
<xsl:template match="time">
    <select name="{@name}">
        <xsl:apply-templates select="../timeitem"/>
    </select>
</xsl:template>

<xsl:template match="timeitem">
    <xsl:choose>
        <xsl:when test="../time/@selected=value">
            <option value="{value}" selected="true"><xsl:value-of
select="name"/></option>
        </xsl:when>
        <xsl:otherwise>
            <option value="{value}"><xsl:value-of select="name"/></option>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

or should I just leave it this way and save the overhead of parsing an extra
24 <timeitem> values.

If sharing the <timeitem> elements is not a performance issue, is there any
way in XML to share all those items from one point of access as they are
really only there for display.  The <time> elements are the ones that have
the data.

Thanks for any advice.

Mike


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • Performance
    • Mike Engelhart - Fri, 10 Mar 2000 10:40:39 -0600 <=