RE: performance of xml serilisation

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi

Thanks for your reply. From my understanding the first time that I serialize
the objects into the cache there would be a big performance hit but when I
perform subsequent serialization/de-serialization the peformance overhead
would be less, is this correct?
--
Scott


"Steven Cheng[MSFT]" wrote:

Hello Scott,

Thank you for posting in the MSDN newsgroup.

From your description, you're developing an ASP.NET web application, in
this application, you have some custom class objects and want to persist
them into the ASP.NET cache or session storage, and you'll choose XML
serialized XML data as the persistent mode. Currently you're wondering
whether there is any potential performance issue or recommendation on this,
correct?

Based on my understanding, .net XML Serizliation(XmlSerializer) will
dynamically generate type specific xmlreader/xmlwriter classes for
underlying xml processing. So such dynamic classes's generation(code
generating and compiling) is a big performance overhead, this will occur at
the first time you use xmlserializer to serialize a class. Are you using
ASP.NET 1.X or 2.0? In .net framework 2.0, it provides the sgen.exe tool
which can help pregenerate xml serization classes so as to avoid the
dynamic class genration and compilation at runtime.

#XML Serializer Generator Tool (Sgen.exe)
http://msdn2.microsoft.com/en-us/library/bk3w6240.aspx

In addition, there are some other things we should take care of when
designing our custom classes which will utilize XML Serialization, you can
have a look at the following msdn article for detailed reference:

#How To: Improve Serialization Performance
http://msdn.microsoft.com/library/en-us/dnpag/html/scalenethowto01.asp?frame
=true

Hope this helps you some.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)








.



Relevant Pages

  • Re: Serialization Question
    ... Note that this option can get tricky, as you are going to return an XML string from the web service method, which may not work for them. ... Create another object that has the clients format and transfer the information from your object to that object when the web routine that this client uses is hit. ... The only reason I can see is you are trying to serialize this information and present it, via some sort of service boundary, as XML, not as a serialized object. ... I would take the XML through a transformation to get the format you desire rather than attempt to have the object serialize differently. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Regarding performance on objects serialized to Xml - thoughts and code presented
    ... instance and add the XML to that. ... > StringWriter sW = new StringWriter; ... > XmlTextWriter XmlW = Xml.XmlTextWriter;> ... > // Serialize PlaceHolders ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Serialization Question
    ... files to a partner organisation and they are expecting an XML file of the ... The only reason I can see is you are trying to serialize this information ... If I had Address as Array(of String) then all parts of address would have ... How could I change things so the the XML file produced is of this format: ...
    (microsoft.public.dotnet.languages.vb)
  • Re: DataSet and best practice in 2.0
    ... from webservices to remoting no? ... which changes the whole game for distributed apps. ... Collections serialize to XML as well so there's not that much ...
    (microsoft.public.dotnet.framework.performance)
  • Re: DataSet and best practice in 2.0
    ... dataset to a byte, which has about 35,000 elements in the array. ... The suggestion was to use Base64 encoding, not xml, to serialize the ... as far as switching to binary serialization, ...
    (microsoft.public.dotnet.framework.performance)