c# – 二进制和XML序列化之间是否存在任何性能差异?

在解析(序列化,反序列化)和通过网络发送数据包方面是否有任何关于二进制和xml序列化之间性能差异的良好估计?

解决方法

不.

它在很大程度上取决于XML文档本身内部的数据类型.如果您有大量结构化数据,则XML的开销会很大.例如,如果您的数据如下所示:

<person>
  <name>Dave</dave>
  <ssn>000-00-0000</ssn>
  <email1>xxxxxx/email1>
</person>
...

如果您的XML文档如下所示,您将获得更多的开销:

<book name="bible">
 In the beginning God created the heavens and the earth. 
 Now the earth was formless and empty ... 
 And if any man shall take away from the words of the book of this prophecy,God shall take away his part out of the book of life,and out of the holy city,and from the things which are written in this book. He which testifieth these things saith,Surely I come quickly. Amen. Even so,come,Lord Jesus.
</book>

所以这不是一个公平的问题.它在很大程度上取决于您打算发送的数据,以及如何/如果您正在压缩它.

相关文章

在要实现单例模式的类当中添加如下代码:实例化的时候:frmC...
1、如果制作圆角窗体,窗体先继承DOTNETBAR的:public parti...
根据网上资料,自己很粗略的实现了一个winform搜索提示,但是...
近期在做DSOFramer这个控件,打算自己弄一个自定义控件来封装...
今天玩了一把WMI,查询了一下电脑的硬件信息,感觉很多代码都...
最近在研究WinWordControl这个控件,因为上级要求在系统里,...