C ++性能序列化 [英] C++ Serialization Performance

查看:94
本文介绍了C ++性能序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建一个分布式的C ++应用程序,需要做大量的正的不同进程和计算机之间传递简单的数据结构的序列化和反序列化。

I'm building a distributed C++ application that needs to do lots of serialization and deserialization of simple data structures that's being passed between different processes and computers.

我不感兴趣的序列化复杂的类层次结构,但更多的发送结构用几个简单的成员,如数字,字符串和数据载体。数据载体往往是许多兆大。
我担心文/做基于XML的方式太慢了,我真的不想写这个,因为我自己喜欢字符串编码和数字字节序的问题可以把它的方式比它更复杂表面上看起来。

I'm not interested in serializing complex class hierarchies, but more of sending structures with a few simple members such as number, strings and data vectors. The data vectors can often be many megabytes large. I'm worried that text/xml-based ways of doing it is too slow and I really don't want to write this myself since problems like string encoding and number endianess can make it way more complicated than it looks on the surface.

我一直在寻找一个位在协议缓冲区和boost.serialize。根据该文件,协议缓冲区似乎很在乎性能。
升压似乎有点在这个意义上更为轻巧,你没有指定的数据格式,我找到这个特定的项目相当方便的外部语言。

I've been looking a bit at protocol buffers and boost.serialize. According to the documents protocol buffers seems to care much about performance. Boost seems somewhat more lightweight in the sense that you don't have an external language for specifying the data format which I find quite convenient for this particular project.

所以我的问题归结到这一点:没有人知道是否升压序列化是快我上面描述的典型使用案例

So my question comes down to this: does anyone know if the boost serialization is fast for the typical use case I described above?

此外,如果有,可能是适合这个其他图书馆,我会很高兴听到他们。

Also if there are other libraries that might be right for this, I'd be happy to hear about them.

推荐答案

我强烈建议协议缓冲区。他们是令人难以置信的简单易用,提供了极大的性能,并采取像字节序和向后兼容性问题的照顾。为了使它更具吸引力,序列化的数据是独立于语言的感谢众多语言实现。

I would strongly suggest protocol buffers. They're incredibly simple to use, offer great performance, and take care of issues like endianness and backwards compatibility. To make it even more attractive, serialized data is language-independent thanks to numerous language implementations.

这篇关于C ++性能序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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