Today almost every application has to work with XML file. In order to work with XML the framework gives us a couple of classes, the most used class XmlDocument.
I use to use XmlDocument until I started to have performance problems in my application.
Why I was using XmlDocument? It is the easier one ;). But "luckily" I had performance problems so I had to study more about dealing with XML,
Then now, let me give you an advise, if you are going to use XML you should go to Daniel Cazzulino weblog and read his Roadmap to High Performance XML,
after that probably you (like me) are going to download the Mvp.xml project.
I'm doing an XML comparison tool, in order to test my tool I have 2 XML files (old.xml and new.xml sizes 6 MB aprox).
- First Implementation using XmlDocument
In this step really I don't remember exactly the numbers, the only thing that I can tell you is that times were
- Using XPathDocument
Why I was using XmlDocument !!! Now times are acceptable, less than half I remember.
I don't know you but when I start to work in performance problems I really enjoy watching how performance numbers go down and down, so in this case
I continued looking for others improvements. In this case I found Daniel Cazzulino weblog.
I downloaded Mvp.xml project and I started to use their classes. At this time the comparison takes 11s aprox.
- Using Mvp.Xml (XPathCache, IndexingXPathNavigator, SubtreeXPathNavigator) the time today is 6.71. Sorry but I don't know exactly the contribution of each class :(
In order to provide times for my application I'm using a simple class from Code Project. You can take a look of it because it is really helpful to have it in your toolbox.
Conclusion: If you are going work with Xml files trust me read the roadmap and use Mvp.xml.