Subject: RE: csv slows down transform
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 6 Oct 2004 10:47:34 +0100
|
Performance questions are always specific to the product. I don't know
libxml so I can only speculate.
One possibility is that it's treating a template rule such as
<xsl:template match="Full_Name">
<xsl:apply-templates />
</xsl:template>
specially because it recognizes that it's identical to the built-in
template, and adding some text to the output kills this optimization.
Just a conjecture. 14 seconds to process 2500 records does seem excessive.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Jonathan Kart [mailto:jkart@xxxxxxxxxxxx]
> Sent: 06 October 2004 00:47
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: csv slows down transform
>
> Hi all,
>
> I have 2 sample stylesheets to show you. They are auto-generated, so
> please forgive the redundancy and other flaws. My question is, what
> does the first stylesheet consistently run slower than the
> second. For
> an xml doc of about 2500 'Contacts' this first sheet takes
> ~14 seconds,
> the second less than 1 second. I swear the only difference
> is that one
> inserts quotes and commas around the data while the other does not.
> It's not a trick question i promise. The time difference is
> substantial. We're using the php libxml extension in a web
> environment
> under windows 200 server, and iis.
>
> Thanks for any help, this is boggling my itty-bitty mind.
>
> SHEET 1
> -----------
> <xsl:stylesheet version="1.0" exclude-result-prefixes="dt"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:dt="http://xsltsl.org/date-time">
> <xsl:import
> href="http://www.newdream.org/CMS/lib/xslsl/stdlib.xsl" />
> <xsl:output method="xml" />
> <xsl:template match="text()">
> <xsl:value-of select="."
> disable-output-escaping="yes" />
> </xsl:template>
> <xsl:template match="*">
> <xsl:copy>
> <xsl:apply-templates select="@*" />
> <xsl:apply-templates select="node()" />
> </xsl:copy>
> </xsl:template>
> <xsl:template match="@*">
> <xsl:copy />
> </xsl:template>
> <xsl:template match="/">
> <xsl:apply-templates />
> </xsl:template>
> <xsl:template match="//region[@id=\'region93\']">
> <xsl:apply-templates />
> </xsl:template>
> <xsl:template match="assignment[@id=\'assignment\']">
> <xsl:apply-templates />
> </xsl:template>
> <xsl:template match="Contacts">
> <xsl:apply-templates select="Full_Name" />
> <xsl:apply-templates select="Activity_Points" />
> <xsl:text>
>
> </xsl:text>
> </xsl:template>
> <xsl:template match="Full_Name">
> "
> <xsl:apply-templates />
> ",
> </xsl:template>
> <xsl:template match="Full_Name" mode="Normal">
> "
> <xsl:apply-templates />
> ",
> </xsl:template>
> <xsl:template match="Activity_Points">
> "
> <xsl:apply-templates />
> ",
> </xsl:template>
> <xsl:template match="Activity_Points" mode="Normal">
> "
> <xsl:apply-templates />
> ",
> </xsl:template>
> </xsl:stylesheet>
>
> SHEET 2 - same thing, but no " no , and no
> ------------
>
> <xsl:stylesheet version="1.0" exclude-result-prefixes="dt"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:dt="http://xsltsl.org/date-time">
> <xsl:import
> href="http://www.newdream.org/CMS/lib/xslsl/stdlib.xsl" />
> <xsl:output method="xml" />
> <xsl:template match="text()">
> <xsl:value-of select="."
> disable-output-escaping="yes" />
> </xsl:template>
> <xsl:template match="*">
> <xsl:copy>
> <xsl:apply-templates select="@*" />
> <xsl:apply-templates select="node()" />
> </xsl:copy>
> </xsl:template>
> <xsl:template match="@*">
> <xsl:copy />
> </xsl:template>
> <xsl:template match="/">
> <xsl:apply-templates />
> </xsl:template>
> <xsl:template match="//region[@id=\'region93\']">
> <xsl:apply-templates />
> </xsl:template>
> <xsl:template match="assignment[@id=\'assignment\']">
> <xsl:apply-templates />
> </xsl:template>
> <xsl:template match="Contacts">
> <xsl:apply-templates select="Full_Name" />
> <xsl:apply-templates select="Activity_Points" />
> </xsl:template>
> <xsl:template match="Full_Name">
> <xsl:apply-templates />
> </xsl:template>
> <xsl:template match="Full_Name" mode="Normal">
> <xsl:apply-templates />
> </xsl:template>
> <xsl:template match="Activity_Points">
> <xsl:apply-templates />
> </xsl:template>
> <xsl:template match="Activity_Points" mode="Normal">
> <xsl:apply-templates />
> </xsl:template>
> </xsl:stylesheet>
|