all groups > dotnet xml > may 2007 >
You're in the

dotnet xml

group:

performance of XslTransform vs XslCompiledTransform


performance of XslTransform vs XslCompiledTransform Andy Fish
5/24/2007 3:45:01 PM
dotnet xml:
Hi,

From reading the documentation, I get the impression that
XslCompiledTransform should be faster than XslTransform

on my test with a large complex document and a large complex XSLT, the
transform took 4 minutes with XslTransform but 7 minutes with
XslCompiledTransform.

However, with the same stylesheet on another large complex document, the
time dropped from 4 minutes with XslTransform to just 45 seconds with
XslCompiledTransform.

any clues as to what might cause this difference in performance? is one of
my results exceptional?

this sort of process is typical in my application so I'd like to get the
best overall performance.

TIA

Andy

Re: performance of XslTransform vs XslCompiledTransform Martin Honnen
5/24/2007 4:56:13 PM
[quoted text, click to view]

When you call the Load method then XslCompiledTransform compiles the
XSLT stylesheet to MSIL. That often takes longer than loading with
XslTransform. On the other hand executing the Transform method, in
particular several times with a compiled stylesheet, should perform much
better with XslCompiledTransform.
See <http://blogs.msdn.com/antosha/archive/2006/07/24/677560.aspx> for
some detailed comparison.
--

Martin Honnen --- MVP XML
Re: performance of XslTransform vs XslCompiledTransform Andy Fish
5/24/2007 5:10:22 PM
[quoted text, click to view]

Thanks for the quick response Martin. I have tried running the same compiled
transformation against the document twice and it was not appreciably quicker
the second time.

I had seen your link and several other related articles and noticed that
they usually put their timings in milliseconds whereas mine are in minutes
(!!), so I wasn't expecting the JIT overhead to be that significant. note
that smaller documents run in a couple of seconds with the same transform.

Andy

[quoted text, click to view]

Re: performance of XslTransform vs XslCompiledTransform Anton Lapounov
5/28/2007 6:16:01 PM
Hello Andy,

The best way to report a bug or a performance issue in System.Xml is to file
it at http://connect.microsoft.com/ and attach simplified repro files. If you
have any issues with Microsoft Connect site, you may send repro files to me
(my email is here: http://antosha.com/workemail.gif), and I will file it for
you.

Thank you for your feedback!
-Anton Lapounov
AddThis Social Bookmark Button