[Yanel-dev] Performance Tuning XSLT

Michael Wechner michael.wechner at wyona.com
Tue May 10 11:14:58 CEST 2011


On 5/10/11 9:36 AM, Balz Schreier wrote:
>
> Hi,
>
> I have searched for quite a while and didn't find concrete answers to 
> my simple question:
>
> Which one of the options below is faster or is the XSLT compiler 
> "smart" enough so that both variants are the same at the end?
>
> 1) I have to read a property in an external XML:
>
> |<xsl:value-of  select="document($path)//city"/>
>
> |
>
> Whenever I need the city, I use the expression above (let's say 100 times)
>
> 2) Instead of calling the document() 100 times, I store the XML node 
> in a variable:
>
> |<xsl:variable  name="node"  select="document($path)"/>
>
> |
>
> And then I use 100 times
>
> |<xsl:value-of  select="$node//city"/>
>
> |
>
> Which one is faster, better, for which reasons?
>

I would assume that (2) is faster, but I guess it depends on the 
implementation (Yanel is currently using Xalan 2.7.0)

Maybe it's best if you ask on one of the Xalan mailing lists or do your 
own profiling by using the expression
a million times in order to see a difference or log the file requests.

HTH

Michael
>
> Thank you!
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wyona.org/pipermail/yanel-development/attachments/20110510/a51a3193/attachment-0001.html>


More information about the Yanel-development mailing list