gpt4 book ai didi

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

转载 作者:数据小太阳 更新时间:2023-10-29 01:48:45 24 4
gpt4 key购买 nike

就解析(序列化、反序列化)和通过网络发送数据包而言,是否可以很好地估计二进制和 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>

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

关于c# - 二进制序列化和 XML 序列化之间是否存在任何性能差异?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/394588/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com