XslCompiledTransform.Transform very slow

XslCompiledTransform is taking more time to transform xml file using xslt files. XslCompiledTransform.Load() , loads and compile xslt faster, but XslCompiledTransform.Transform() is taking more time to transform then using XslTransform class. I have C# code in xslt files for data manipulations and sometimes xml files may be big in size.



Answer this question

XslCompiledTransform.Transform very slow

  • David_Lindley

    The memory consumption the Transform method has depends on the size of the XML input and the size of the transformation result, it builds an XPathDocument in memory for the source tree and transforms that to a result tree that is being serialized.



  • Michael Barrett

    I didn't.

    Can you please send it to: vascoveiga@hotmail.com

    Or post it on a website where i can grab it from

    --VV [MS]
    vascov@microsoft.com


  • peterLH

    Hi,

    I'm sorry for not replying.

    In all honesty i don't remember receiving your message.
    Can you please resend it

    I'll take a look.

    --VV [MS]
    vascov@microsoft.com


  • caligula

    Do you have any results or recommendations regarding the XslCompiledTransform performance issues Thanks.
  • Crax123

    Hello Vandy,

    I apologize for the delay. Vasco has asked me to look at the files you sent. I believe your question has been already answered by Sergey Dubinets in this thread:

    For extended answer look to: http://blogs.msdn.com/antosha/. In short: In addition to compilation the first transform would also pay the price for JITing. Jtting will happen in first run of Transform() method but just once.

    To work around this issue, we recommend caching compiled stylesheets whenever possible. Let us know if you have more questions.

    Thanks,
    Anton


  • xlordt

    Hi,

    I am facing a Huge memory consumption problem with xslCompiledTransformation object.

    I am using XSLCompiledTransform Class to apply XSLT on XML files. Now the problem is when ever I load the Transform object with XSLT ( calling objTransform.Load(<xsltFilepath>) ) it is occupying huge memory ( like for a 700kb xslt file it is occupying almost 30MB ) and also the Transform() method also occupying some 15MB while applying the Transformation.

    Is there any solution to this issue..

    Does any one of u faced these kind of problem while using XSlCompiledTransform object

    Pls Let me know if u have anything regarding this kind of problem.


  • brad0999

    Hi Martin,

    I agree with you. But the concern is that when I use XslTransform class for Transformation (of XmlFile size 2-KB & XSLT file size 740 KB ) it takes hardly some 15MB at the same time XslCompiledTransform almost 45 MB.

    Is there is any way to reduce this memory consumption while using XslCompiledTransform(). Coz. I am working on C#.NET 2.0 verison I dont want to use XslTransform which is obsolete in 2.0.

    Thanks,

    Ravi


  • su45937

    We are working with Mohit to reproduce the same behavior and identify the cause. So far, we could not reproduce the difference on our side (XslCompiledTransform takes the ~same transform time)

    If you're having similar issues, please have your xml + xsl files and a small program to repro it sent to me (vascov@microsoft.com) and i'll gladly take a look.

    Generally speaking, the main difference between XslCompiledTransform and XslTransform is the compilation time, which should be longer for XslCompiledTransform. For that reason, depending on your scenario (transform time, compile time, server or client,...), caching the transforms can yield some gains.

    For the most part, the transform time should usually be faster using XslCompiledTransform. If you have cases where that's not the case, we would love to take a look at them.

    Thanks

    --VV [MS]
    vascov@microsoft.com


  • QianChen

    I was having the same problem and emailed my xml/xsl/program to Vasco over a month ago but havent heard back. Is anyone still monitoring this thread Was the problem resolved in working with Mohit

    Thanks


  • Duncan McC

    I still have not received any msg...

    --VV [MS]
    vascov@microsoft.com


  • ChandraP

    I would like to look at your XML and XSL files and the way you load them (XmlDocument, XPathDocument, etc.). If possible, please send them to this address.

    Thanks,
    Anton


  • Josh Smith

    It seams that thread is still alive.

    For extended answer look to: http://blogs.msdn.com/antosha/

    In short: In addition to compilation the first transform would also pay the price for JITing. Jtting will happen in first run of Transform() method but just once. This is "By design".

    XslTransform.Load() doesn't have this problem.



  • Amos Soma

    We have received the files and will analyze them. Thanks.


  • Selectis

    Vasco, I just sent you an email (on Monday the 14th). Let me know if you did not receive it.
  • XslCompiledTransform.Transform very slow