微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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>

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

原文地址:https://www.jb51.cc/csharp/98306.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐