We have a relatively complex XSLT file.

.NET Version is 3.5 - MVC 2 app running in IIS7.5

When we do an XsltCompiledTransform.Transform, the very first time it takes about one minute. All subsequent times it takes less than a second regardless of what the input XML looks like.

The initial Transform will get a StackOverflowException if we don't put it in a new thread, so we always do this in a new thread. The XsltCompiledTransform object is a static object, so we don't recreate it every time we do a Transform.

This behaviour is not documented anywhere in MSDN as far as I know. The documentation states to compile your XSLT using xsltc.exe (we did this) so that it doesn't spend a lot of time compiling the XSLT when you call the Load method as it's already compiled. Unfortunately, this didn't increase the performance when we called Load, and regardless of if we Load the XSLT text or the assembly, the first Transform takes one minute, and all subsequent transforms are lightning fast.

Unfortunately, this is requiring us to do a "dummy" transform on a very simple piece of XML text at startup, so that the first user will not experience a one minute delay with this transformation.

The transformations are fairly large pieces of XML, but that doesn't have any impact on Transform time. If the XML is 1,500KB (typical) or less than 1KB (as in our dummy transform which has only a single XML tag) it takes about 1 minute to do the first Transform.

Has anyone experienced anything like this? Any ideas on how to resolve this as this seems like undocumented behaviour.

Related posts

Recent Viewed