Welcome to MSDN Blogs Sign in | Join | Help

Marcelo's WebLog

Improving the world one entity at a time
XslCompiledTransform and large template elements

When loading / compiling an XSLT document into an XslCompiledTransform instance, we've seen some customers hit an interesting gotcha.

In this case, a particular stylesheet had grown over time, through a series of, erm, clipboard operations, to about a 300KB file with a single template. Rather than factoring out common processing, we found it was repeated. While the functionality was correct, it took many minutes and a large amount of memory to compile. Why? Because a template translates (roughly) to a generated .NET method, which in this case turned out to be over 500KB in IL (normally a method will turn out to have less than 1KB). Clearly this is not a common case scenario, and the JIT was designed for a different point, but a mechanical translation can end up producing these kinds of problems.

So, remember - factoring is good for you, your platform, and your future program maintainers! Which probably includes you as well :)

Enjoy!

Posted: Tuesday, December 01, 2009 2:00 PM by marcelolr
Filed under:

Comments

No Comments

New Comments to this post are disabled
Page view tracker