Aloha
I have an 8 MB XML file that I want to deserialize. I am using this code:
public static T Deserialize<T>(string xml)
{
TextReader reader = new StringReader(xml);
Type type = typeof(T);
XmlSerializer serializer = new XmlSerializer(type);
T obj = (T)serializer.Deserialize(reader);
return obj;
}
This code works in about a minute, which seems pretty slow to me. I tried using sgen.exe to precompile the dll serialization, but this did not change the performance.
What other options to improve performance?
[edit] I need an object that is created by deserialization to perform (basic) transformations. XML is obtained from an external web service.
source
share