Home

Awesome

C++ Serialization Benchmark Build Status

This benchmark suite accompanies the public release of the Cista++ serialization library.

This repository contains benchmarks for C++ (binary & high performance) serialization libraries. The goal was to create a benchmark based on a non-trivial data structure. In this case, we serialize, deserialize and traverse a graph (nodes and edges). Since the goal was to have a data structure containing pointers, we choose an "object oriented" representation of a graph instead of a simple adjacency matrix. Some frameworks do no support cyclic data structures. Thus, instead of having node pointers in the edge object, we just reference start and destination node by their index. Benchmarks are based on the Google Benchmark framework.

This repository compares the following C++ binary serialization libraries:

Other Benchmarks

Build & Execute

To run the benchmarks you need a C++17 compatible compiler and CMake. Tested on Mac OS X (but Linux should be fine, too).

git clone --recursive github.com:felixguendling/cpp-serialization-benchmark.git
cd cpp-serialization-benchmark
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
./cpp-serialization-benchmark

Results

LibrarySerializeDeserializeFast DeserializeTraverseDeserialize & TraverseSize
Cap’n Proto76 ms0.00 ms0.0 ms216 ms221 ms50.5M
cereal216 ms111.00 ms-67 ms174 ms37.8M
Cista++ offset4 ms0.16 ms0.0 ms67 ms66 ms25.3M
Cista++ raw650 ms24.80 ms24.8 ms66 ms91 ms176.4M
Flatbuffers1409 ms35.70 ms0.0 ms75 ms75 ms63.0M
zpp_bits4 ms6.58 ms6.6 ms65 ms72 ms37.8M

Cista++ offset describes the "slim" variant (where the edges use indices to reference source and target node instead of pointers).

Exact results can be found here.

Benchmarks were run on Ubuntu 20.04 on an AMD Ryzen 9 5900X, compiled with GCC 11.

Compilation Times

Compilation times are measured with code generation but without building the code generators or static libraries (Cap’n Proto, Flatbuffers).

Libraryclang-7 on Mac OS X
Cap’n Proto0.440s
cereal1.827s
Cista++ raw1.351s
Flatbuffers0.857s

Contribute

You have found a mistake/bug or want to contribute new benchmarks? Feel free to open an issue/pull request! :smiley: