Performance: XDocument versus XmlDocument

前端 未结 2 739
庸人自扰
庸人自扰 2020-12-03 13:58

I have read a comparison between the two here. This is primarily a question of performance, relating to both memory and speed.

I\'ve got several XML documents that a

2条回答
  •  感动是毒
    2020-12-03 14:25

    XmlReader is the lowest API in .NET which all other XML APIs in .NET use under the scenes. Naturally that means it's the hardest to deal with, as well as fastest. It's a streaming API, so it is best fit for memory as well.

    Between XmlDocument and XDocument aka Linq to XML, here are some raw numbers: http://blogs.msdn.com/b/codejunkie/archive/2008/10/08/xmldocument-vs-xelement-performance.aspx

    Both of which find XDocument class being faster/more efficient. Programmer productivity/efficiency shouldn't be ignored as well. Personally I find it easier to work with XDocument.

提交回复
热议问题