.NET 中快速紧凑的对象序列化 [英] Fast and compact object serialization in .NET

查看:16
本文介绍了.NET 中快速紧凑的对象序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用对象序列化在 Mono 之间通过网络进行通信服务器和 Silverlight 客户端.序列化的空间效率和速度非常重要,因为服务器将托管多个实时游戏.

I want to use object serialization to communicate over the network between a Mono server and Silverlight clients. It is pretty important that serialization is space efficient and pretty fast, as the server is going to host multiple real time games.

我应该使用什么技术?BinaryFormatter 为序列化类(版本、区域性、类名、属性名等)增加了很多开销,这些开销在此应用程序中是不需要的.

What technique should I use? The BinaryFormatter adds a lot of overhead to serialized classes (Version, culture, class name, property names, etc.) that is not required within this application.

我该怎么做才能提高空间利用率?

What can I do to make this more space efficient?

推荐答案

您可以使用 Protocol Buffers.我正在将我所有的序列化代码从 BinaryFormatter 压缩到 Protocol Buffers 并获得非常好的结果.在时间和空间上都更有效率.

You can use Protocol Buffers. I'm changing all my serialization code from BinaryFormatter with compression to Protocol Buffers and obtaining very good results. It's more efficient in both time and space.

Jon SkeetMarc Gravell.

更新:可以在此处找到官方 .NET 实现.

这篇关于.NET 中快速紧凑的对象序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆