Re: [xsl] Benefits of using xsl:key

Subject: Re: [xsl] Benefits of using xsl:key
From: Jesper Tverskov <jesper.tverskov@xxxxxxxxx>
Date: Wed, 4 Nov 2009 20:22:20 +0100
I have made a more realistic input file, but it leads to new results
reminding me of my first statement: It is difficult to create a test
example showing that xsl:key can speed up the transformation.

In the original example, three elements were copied and pasted over
and over again to create a file of 3000 lines. This gave an input file
with only two elements having different content. The speed difference
in usig xsl:key or not was close to 1:100. (10s/0.1s).

I have now made a new input file. I transformed the original input fil
to a new input file making all the id attribute values unique, and
also all the content unique. I then hand edited the new file for 15 of
the elements, making the content the same for some other element.

The transformation with Saxon HE, PE and EE  without using xsl:key is
now much faster, 4.5s, but, as a big surprise (to me), the use of
xsl:key has no influence on the transformation speed still being 4.5s,
and also the optimization option in EE has no effect!

I'm a little confused. My conclusion is that xsl:key can make a
transformation faster in some situations. It very much depends on
data.

Question: What is the rule of thumb for data sets where the use of
xsl:key is likely to make a big difference?

Cheers,
Jesper

Current Thread