{"id":13418832,"url":"https://github.com/thekvs/cpp-serializers","last_synced_at":"2026-01-11T02:39:43.798Z","repository":{"id":45197214,"uuid":"13274425","full_name":"thekvs/cpp-serializers","owner":"thekvs","description":"Benchmark comparing various data serialization libraries (thrift, protobuf etc.) for C++","archived":false,"fork":false,"pushed_at":"2020-01-28T08:57:08.000Z","size":543,"stargazers_count":717,"open_issues_count":19,"forks_count":111,"subscribers_count":40,"default_branch":"master","last_synced_at":"2024-07-31T22:44:16.991Z","etag":null,"topics":["apache-avro","avro","boost","c-plus-plus","capn-proto","cereal","cpp","flatbuffers","msgpack","performance-testing","protobuf","serialization","thrift","yas"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thekvs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-02T15:15:02.000Z","updated_at":"2024-07-24T08:10:08.000Z","dependencies_parsed_at":"2022-08-25T08:00:56.639Z","dependency_job_id":null,"html_url":"https://github.com/thekvs/cpp-serializers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thekvs%2Fcpp-serializers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thekvs%2Fcpp-serializers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thekvs%2Fcpp-serializers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thekvs%2Fcpp-serializers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thekvs","download_url":"https://codeload.github.com/thekvs/cpp-serializers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243685505,"owners_count":20330980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache-avro","avro","boost","c-plus-plus","capn-proto","cereal","cpp","flatbuffers","msgpack","performance-testing","protobuf","serialization","thrift","yas"],"created_at":"2024-07-30T22:01:07.644Z","updated_at":"2026-01-11T02:39:43.740Z","avatar_url":"https://github.com/thekvs.png","language":"C++","readme":"# About\n\nCompare various data serialization libraries for C++.\n\n* [Thrift](http://thrift.apache.org/)\n* [Protobuf](https://code.google.com/p/protobuf/)\n* [Boost.Serialization](http://www.boost.org/libs/serialization)\n* [Msgpack](http://msgpack.org/)\n* [Cereal](http://uscilab.github.io/cereal/index.html)\n* [Avro](http://avro.apache.org/)\n* [Capnproto](https://capnproto.org/)\n* [Flatbuffers](https://google.github.io/flatbuffers/)\n* [YAS](https://github.com/niXman/yas)\n\n# Build\n\nThis project does not have any external serialization libraries dependencies. All (boost, thrift etc.) needed libraries are downloaded and built automatically, but you need enough free disk space (approx. 2.3G) to build all components. To build this project you need a compiler that supports C++14 features. Project was tested with Clang and GCC compilers.\n\n1. `git clone https://github.com/thekvs/cpp-serializers.git`\n1. `cd cpp-serializers`\n1. `mkdir build`\n1. `cd build`\n1. `cmake -DCMAKE_BUILD_TYPE=Release ..`\n1. `cmake --build .`\n\n# Usage\n\n```\n$ ./benchmark -h\nBenchmark various C++ serializers\nUsage:\n  benchmark [OPTION...]\n\n  -h, --help             show this help and exit\n  -l, --list             show list of supported serializers\n  -c, --csv              output in CSV format\n  -i, --iterations arg   number of serialize/deserialize iterations\n  -s, --serializers arg  comma separated list of serializers to benchmark\n```\n\n* Benchmark **all** serializers, run each serializer 100000 times:\n```\n$ ./benchmark -i 100000\n```\n* Benchmark only **protobuf** serializer, run it 100000 times:\n```\n$ ./benchmark -i 100000 -s protobuf\n```\n* Benchmark **protobuf** and **cereal** serializers only, run each of them 100000 times:\n```\n$ ./benchmark -i 100000 -s protobuf,cereal\n```\n\n# Results\n\nFollowing results were obtained running 1000000 serialize-deserialize operations 50 times and then averaging results on a typical desktop computer with Intel Core i7 processor running Ubuntu 16.04. Exact versions of libraries used are:\n\n* thrift 0.12.0\n* protobuf 3.7.0\n* boost 1.69.0\n* msgpack 3.1.1\n* cereal 1.2.2\n* avro 1.8.2\n* capnproto 0.7.0\n* flatbuffers 1.10.0\n* YAS 7.0.2\n\n| serializer     | object's size | avg. total time |\n| -------------- | ------------- | --------------- |\n| thrift-binary  | 17017         | 1190.22         |\n| thrift-compact | 13378         | 3474.32         |\n| protobuf       | 16116         | 2312.78         |\n| boost          | 17470         | 1195.04         |\n| msgpack        | 13402         | 2560.6          |\n| cereal         | 17416         | 1052.46         |\n| avro           | 16384         | 4488.18         |\n| yas            | 17416         | 302.7           |\n| yas-compact    | 13321         | 2063.34         |\n\n\n## Size\n\n![Size](images/size.png)\n\n## Time\n\n![Time](images/time.png)\n\nFor capnproto and flatbuffers since they already store data in a \"serialized\" form and serialization basically means getting pointer to the internal storage, we measure full **build**/serialize/deserialize cycle. In the case of other libraries we measure serialize/deserialize cycle of the already built data structure.\n\n| serializer     | object's size | avg. total time |\n| -------------- | ------------- | --------------- |\n| capnproto      | 17768         | 400.98          |\n| flatbuffers    | 17632         | 491.5           |\n\n![Time](images/time2.png)\n\nSize measured in bytes, time measured in milliseconds.\n","funding_links":[],"categories":["TODO scan for Android support in followings","C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthekvs%2Fcpp-serializers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthekvs%2Fcpp-serializers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthekvs%2Fcpp-serializers/lists"}