Using DOM (i.e. System.Xml.XmlDocument
) is likely to be slower, because of the rich navigation support (all those references start to add up), and this overhead will become more significant as the number of nodes increases.
Simpler object models (System.Xml.Linq.XDocument
and System.Xml.XPath.XPathDocument
) don't habe such complex structures, but allow navigation by other means. This might add to CPU overhead but should save memory.
In the end you need to profile (time and space) in your case, and also consider how much real (user perceived) difference it makes.
But, for ultimate performance don't load the whole document into memory at all: use System.Xml.XmlReader
and System.Xml.XmlWriter
and do everything in a stream. Of course this adds development cost.
.NET has a rich (maybe too rich) set of XML APIs, which is best (or at least, least worst) for you can only be determined by you making the trade-offs which are best for you.
Personally I would avoid XmlDocument
and use either XPathDocument
(especially to read, and query with XPath) or XElement
(especially to create) where XmlReader/XmlWriter does not give enough of a performance boost to justify.