Re: [xslt] libxslt optimizations/performance



Daniel Veillard wrote:
> 
> On Fri, Jan 31, 2003 at 12:33:57PM -0500, Gennady Feldman wrote:
> >
> > While optimizing some of my XSL files I noticed that in some cases there
> > is a performance difference where it shouldn't really be.
> >
> > if you do something like:
> >   <zzz>
> >      <xsl:attribute name="id">
> >             <xsl:value-of select="@id"/>
> >      </xsl:attribute>
> >   </zzz>
> >
> > instead of:
> >   <zzz id="{@id}"/>
> >
> > then the first case is faster than the second case where logically it's
> > the same thing (isn't it?).
> 
>   yes but you add the requirement to parse {@id}, and that is done
> only at runtime, while the structure based version has more preprocessing
> done at compile time. Attribute value templates are costly in libxslt.
> 
In terms of performance it seems that it's better to parse/compile it
during
compilation time rather than doing it at runtime. If I understand this
correctly
the line is parsed every time a match is made in this xsl:template
block. What 
this means that the line parsing could take ~1ms at compile time vs
>10ms 
during runtime depending on the template and number of matches.

So libxslt could be changed to parse it during compile time. Also at
runtime it
could just copy the constant values or pull the attribute the same way
it does
for my first case. I know that after I changed my XSL files to use
xsl:attribute
I saw a performance difference. What do you think about this little
optimization 
for libxslt? 

G.F. aka Gena01
http://www.gena01.com



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