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

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

问题描述

我想用对象序列化过服务器和Silverlight客户端之间的网络通信。 这是pretty的重要序列化节省空间和pretty的快,因为服务器将承载多个实时游戏。

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的 。我改变了我所有的序列化code从BinaryFormatter的使​​用COM pression议定书缓冲器并取得了很好的效果。它是在时间和空间更有效。

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.

有两种.NET实现由乔恩斯基特和的马克Gravell

There are two .NET implementations by Jon Skeet and Marc Gravell.

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

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