Improving Xml Performance

Now a days every .NET developer make use of Xml in some way or the other. But when you are middle tier developer, then you can’t get rid of xml manipulation. The performance of an application significantly affects the way we use code for reading, writing, parsing, quering and validating Xml documents.
Here are certain guidelines to address xml perfornace issues in .NET applications.

Performance and Scalability Issues

  • Resource consumption
  • Extreme memory consumption
  • Inefficient tranformations
  • Inappropriate use of the DataSet
  • Failure to cache and to precompile schemas, style sheets, and XPath queries
  • Inefficient data retreival
  • Design Consideration

  • Choose the appropriate XML class for the job
  • Consider validating large documents
  • Process large documents in chunks if possible
  • Use streaming interfaces
  • Consider hard-coded transformations
  • Consider element and attribute name lengths
  • Consider sharing the XmlNameTable
  • Parsing Xml

  • Use XmlTextReader to parse large XML documents
  • Use XmlValidatingReader for validation
  • Consider combining XmlReader and XmlDocument
  • On the XmlReader use the MoveToContent and Skip methods to skip unwanted items
  • Validating XML

  • Use XmlValidatingReader
  • Do not validate the same document more than once
  • Consider caching the schema
  • Via: Patterns & Practices

    Advertisements

    One Response to Improving Xml Performance

    1. […] original post here: Improving Xml Performance « Raheem's Tech Diary If you enjoyed this article please consider sharing […]

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out /  Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out /  Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out /  Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out /  Change )

    w

    Connecting to %s

    %d bloggers like this: