Re: [xslt] efficiency



Hello.
>   use --profile to see in which templates the time is spent. Like any
> programming language XSLT can be made quite slow in just a couple of 
> unwisely programmed lines. Understanding the cost of each operations
It's a very good topic. Daniel, you know all details of libxslt realization very well, so can you tell, please, which XSLT conctructions are faster (I mean time of parsing + time of transforming)?
<xsl:apply-templates/>
or
<xsl:apply-templates select="*"/>
<xsl:for-each select="elem">...
or
<xsl:apply-templates select="elem"/>
<elem>...
or
<xsl:element name="elem">...
<elem><xsl:attribute name="elem"><xsl:value-of select="@attr-value"/>literal</xsl:attribute> ...
or
<elem attr-name="{@attr-value}literal">...
<xsl:value-of select="xpath-expr"/><xsl:text>literal</xsl:text>
or
<xsl:value-of select="concat(xpath-expr, 'literal')"/>
<xsl:value-of select="light-xpath-expr"/>....<xsl:value-of select="light-xpath-expr"/>
or
<xsl:variable name="var" select="light-xpath-expr"/><xsl:value-of select="$var"/>..<xsl:value-of select="$var"/>
What about ther synonymic XSLT constructions?
I used --profile option and found that all first samples are faster than the second ones. Maybe I'm not right somewhere.
With best regards, Alexey.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]