Unfortunately, I'm working on a website that uses XSL for everything. The performance is dire. Time spent in JIT is like 30%!
I always put the fact that this company needs 4 servers to run its little sites is down to the XSL, but I'm finally doing a proper perf review and although XSL is totally the culprit, I suspect that XSL isn't supposed to be this bad, that the original programmers (who were JavaScript guys) misused the XslCompiledTransform
type.
Problem is, I'm no better able to use this API myself. The class was renewed for .NET 2.0 with compilation caching included. I have spent all day trying to work out under what circumstances caching works; originally the code newed-up an XslCompiledTransform
for each transformation, which didn't seem right but making it static also doesn't help - performance profiling shows no improvement.
Further, in the debugger output pane, I can see Loaded 'System.Xml.Xsl.CompiledQuery.5'
popping up for the same stylesheet, so it looks like its compiling, loading again each time.
It's suddenly occurred to me that maybe I'm supposed to do the caching, i.e. that I'm supposed to keep a store with one of these XslCompiledTransform
instances for each stylesheet, preloaded or lazy-loaded.
Is this right?? Keeping one instance and calling Load
many times for each stylesheet is incorrect?