kentonv / cpp-serializers

Benchmark comparing various data serialization libraries (thrift, protobuf etc.) for C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Thrift vs. Protobuf vs. Boost.Serialization vs. Msgpack vs. Cereal vs. Avro serialization/deserialization time test for C++.

Build

This project does not have any external library dependencies. All (boost, thrift etc.) needed libraries are downloaded and built automatically, but you need enough free disk space to build all components. To build this project you need a compiler that supports C++11 features. Project was tested with GCC 4.8.2 (Ubuntu 14.04).

$ git clone https://github.com/thekvs/cpp-serializers.git
$ mkdir /path/to/build-root/
$ cd /path/to/build-root/
$ cmake /path/to/cpp-serializers -DCMAKE_BUILD_TYPE=Release
$ make

Usage

  • Test all serializers, run each serializer 100000 times:
$ ./test 100000
  • Test only protobuf serializer, run it 100000 times:
$ ./test 100000 protobuf
  • Test protobuf and cereal serializers only, run each of them 100000 times:
$ ./test 100000 protobuf cereal

Results

Following results were obtained running 1000000 serialize-deserialize operations 50 times and then averaging results on a typical desktop computer with Intel Core i5 processor running Ubuntu 14.04. Exact versions of libraries used are:

  • thrift 0.9.1
  • protobuf 2.6.0
  • boost 1.56.0
  • msgpack 0.5.9
  • cereal 1.0.0
  • avro 1.7.7
serializer object's size avg. total time
thrift-binary 17017 24681
thrift-compact 11597 29455
protobuf 12571 21034
boost 17470 22945
msgpack 11902 23560
cereal 17416 10688
avro 12288 31750

Size mesuared in bytes, time mesuared in milliseconds.

Graphical representations
Size

Size

Time

Time

About

Benchmark comparing various data serialization libraries (thrift, protobuf etc.) for C++


Languages

Language:C++ 79.5%Language:CMake 18.2%Language:R 1.6%Language:Cap'n Proto 0.3%Language:Thrift 0.2%Language:Protocol Buffer 0.2%