Skip to content

Commit 3015690

Browse files
committed
Update serializers to current versions (10-03-2019).
That means that the updated versions are now: * thrift 0.12.0 * protobuf 3.7.0 * boost 1.69.0 * msgpack 3.1.1 * cereal 1.2.2 * avro 1.8.2 * capnproto 0.7.0 * flatbuffers 1.10.0 * YAS 7.0.2 Only avro was not updated. This version of capnproto requires C++14. This change in requirements is reflected in CMakeLists.txt and README.md. The benchmark is performed on my system, which has slightly different specs from the original author's. This is also reflected in the README.md. Graphs are updated to reflect these results.
1 parent 4ed2bdb commit 3015690

16 files changed

+507
-466
lines changed

CMakeLists.txt

+21-21
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ include(ExternalProject)
1313

1414
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1515

16-
CHECK_CXX_COMPILER_FLAG("-std=c++11" CXX11)
17-
if (NOT CXX11)
18-
message(FATAL_ERROR "C++ compiler doesn't support C++11")
16+
CHECK_CXX_COMPILER_FLAG("-std=c++14" CXX14)
17+
if (NOT CXX14)
18+
message(FATAL_ERROR "C++ compiler doesn't support C++14")
1919
endif()
2020

2121
CHECK_INCLUDE_FILES("inttypes.h" HAVE_INTTYPES_H)
@@ -58,8 +58,8 @@ set(boost_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/boost)
5858
ExternalProject_Add(
5959
boost
6060
PREFIX ${boost_PREFIX}
61-
URL "http://netcologne.dl.sourceforge.net/project/boost/boost/1.62.0/boost_1_62_0.tar.gz"
62-
URL_MD5 "6f4571e7c5a66ccc3323da6c24be8f05"
61+
URL "http://netcologne.dl.sourceforge.net/project/boost/boost/1.69.0/boost_1_69_0.tar.gz"
62+
URL_MD5 "b50944c0c13f81ce2c006802a1186f5a"
6363
CONFIGURE_COMMAND ${boost_PREFIX}/src/boost/bootstrap.sh --with-libraries=serialization,filesystem,system,program_options,iostreams --prefix=${boost_PREFIX}
6464
BUILD_COMMAND ./bjam link=static cxxflags='-fPIC'
6565
INSTALL_COMMAND ./bjam link=static install
@@ -79,9 +79,9 @@ ExternalProject_Add(
7979
thrift
8080
PREFIX ${thrift_PREFIX}
8181
DEPENDS boost
82-
URL "http://www-eu.apache.org/dist/thrift/0.10.0/thrift-0.10.0.tar.gz"
83-
URL_MD5 "795c5dd192e310ffff38cfd9430d6b29"
84-
CONFIGURE_COMMAND CXX=${CMAKE_CXX_COMPILER} CC=${CMAKE_C_COMPILER} ${thrift_PREFIX}/src/thrift/configure --prefix=${thrift_PREFIX} --libdir=${thrift_PREFIX}/lib --with-boost=${Boost_INCLUDE_DIRS} --enable-shared=no --with-libevent=no --with-c_glib=no --with-java=no --with-erlang=no --with-python=no --with-perl=no --with-php=no --with-php_extension=no --with-ruby=no --with-haskell=no --with-go=no --with-d=no --with-lua=no --with-qt4=no --with-qt5=no --with-nodejs=no --disable-tests --enable-plugin=no
82+
URL "http://www-eu.apache.org/dist/thrift/0.12.0/thrift-0.12.0.tar.gz"
83+
URL_MD5 "3deebbb4d1ca77dd9c9e009a1ea02183"
84+
CONFIGURE_COMMAND CXX=${CMAKE_CXX_COMPILER} CC=${CMAKE_C_COMPILER} ${thrift_PREFIX}/src/thrift/configure --prefix=${thrift_PREFIX} --libdir=${thrift_PREFIX}/lib --with-boost=${Boost_INCLUDE_DIRS} --enable-shared=no --with-libevent=no --with-c_glib=no --with-java=no --with-erlang=no --with-python=no --with-perl=no --with-php=no --with-php_extension=no --with-ruby=no --with-haskell=no --with-go=no --with-d=no --with-lua=no --with-qt4=no --with-qt5=no --with-nodejs=no --with-cl=no --with-dotnetcore=no --with-nodets=no --with-rs=no --disable-tests --enable-plugin=no
8585
BUILD_COMMAND $(MAKE)
8686
INSTALL_COMMAND $(MAKE) install
8787
BUILD_IN_SOURCE 1
@@ -97,8 +97,8 @@ set(msgpack_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/msgpack)
9797
ExternalProject_Add(
9898
msgpack
9999
PREFIX ${msgpack_PREFIX}
100-
URL "https://github.com/msgpack/msgpack-c/releases/download/cpp-2.1.3/msgpack-2.1.3.tar.gz"
101-
URL_MD5 "e604cee971f20f8b4f885163deca2062"
100+
URL "https://github.com/msgpack/msgpack-c/releases/download/cpp-3.1.1/msgpack-3.1.1.tar.gz"
101+
URL_MD5 "99ddfbc004576d5b5261a7f0e68962e7"
102102
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${msgpack_PREFIX} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
103103
BUILD_IN_SOURCE 1
104104
LOG_UPDATE ON
@@ -112,8 +112,8 @@ set(protobuf_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/protobuf)
112112
ExternalProject_Add(
113113
protobuf
114114
PREFIX ${protobuf_PREFIX}
115-
URL "https://github.com/google/protobuf/releases/download/v3.1.0/protobuf-cpp-3.1.0.tar.gz"
116-
URL_MD5 "bd5e3eed635a8d32e2b99658633815ef"
115+
URL "https://github.com/protocolbuffers/protobuf/releases/download/v3.7.0/protobuf-cpp-3.7.0.tar.gz"
116+
URL_MD5 "f1631a8e551e569273d78538f6ecf41c"
117117
CONFIGURE_COMMAND CXX=${CMAKE_CXX_COMPILER} CC=${CMAKE_C_COMPILER} ${protobuf_PREFIX}/src/protobuf/configure --prefix=${protobuf_PREFIX} --libdir=${protobuf_PREFIX}/lib --enable-shared=no
118118
BUILD_COMMAND $(MAKE)
119119
INSTALL_COMMAND $(MAKE) install
@@ -130,8 +130,8 @@ set(capnproto_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/capnproto)
130130
ExternalProject_Add(
131131
capnproto
132132
PREFIX ${capnproto_PREFIX}
133-
URL "https://github.com/capnproto/capnproto/archive/v0.6.1.tar.gz"
134-
URL_MD5 "481d0f2fe24f46ce25234ea9704ef0b4"
133+
URL "https://github.com/capnproto/capnproto/archive/v0.7.0.tar.gz"
134+
URL_MD5 "a9de5f042f4cf05515c2d7dfc7f5df21"
135135
CONFIGURE_COMMAND CXX=${CMAKE_CXX_COMPILER} CC=${CMAKE_C_COMPILER} cd ${capnproto_PREFIX}/src/capnproto/c++ && ${AUTORECONF} -i && cd - && ${capnproto_PREFIX}/src/capnproto/c++/configure --prefix=${capnproto_PREFIX} --libdir=${capnproto_PREFIX}/lib --enable-shared=no
136136
BUILD_COMMAND $(MAKE)
137137
INSTALL_COMMAND $(MAKE) install
@@ -149,8 +149,8 @@ set(cereal_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/cereal)
149149
ExternalProject_Add(
150150
cereal
151151
PREFIX ${cereal_PREFIX}
152-
URL "https://github.com/USCiLab/cereal/archive/v1.2.1.tar.gz"
153-
URL_MD5 "64476ed74c19068ee543b53ad3992261"
152+
URL "https://github.com/USCiLab/cereal/archive/v1.2.2.tar.gz"
153+
URL_MD5 "4c56c7b9499dba79404250ef9a040481"
154154
CONFIGURE_COMMAND ""
155155
BUILD_COMMAND ""
156156
INSTALL_COMMAND mkdir -p ${cereal_PREFIX}/include/ && cp -r ${cereal_PREFIX}/src/cereal/include/cereal ${cereal_PREFIX}/include/
@@ -181,8 +181,8 @@ set(flatbuffers_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/flatbuffers)
181181
ExternalProject_Add(
182182
flatbuffers
183183
PREFIX ${flatbuffers_PREFIX}
184-
URL "https://github.com/google/flatbuffers/archive/v1.7.1.tar.gz"
185-
URL_MD5 "81934736f31fbd2cfdb513e71b53b358"
184+
URL "https://github.com/google/flatbuffers/archive/v1.10.0.tar.gz"
185+
URL_MD5 "f7d19a3f021d93422b0bc287d7148cd2"
186186
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${flatbuffers_PREFIX} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
187187
LOG_UPDATE ON
188188
LOG_CONFIGURE ON
@@ -196,8 +196,8 @@ set(yas_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/yas)
196196
ExternalProject_Add(
197197
yas
198198
PREFIX ${yas_PREFIX}
199-
URL "https://github.com/niXman/yas/archive/6.0.2.zip"
200-
URL_MD5 "ed1c63a6a6bb2db2ad7f8547192d79a7"
199+
URL "https://github.com/niXman/yas/archive/7.0.2.tar.gz"
200+
URL_MD5 "d55353960467afabc6774583880a30f0"
201201
CONFIGURE_COMMAND ""
202202
BUILD_COMMAND ""
203203
INSTALL_COMMAND mkdir -p ${yas_PREFIX}/include/ && cp -r ${yas_PREFIX}/src/yas/include/yas ${yas_PREFIX}/include/
@@ -307,4 +307,4 @@ add_executable(
307307
)
308308
add_dependencies(benchmark thrift msgpack protobuf capnproto boost cereal avro flatbuffers yas)
309309
target_link_libraries(benchmark ${LINKLIBS})
310-
set_target_properties(benchmark PROPERTIES COMPILE_FLAGS "-std=c++11")
310+
set_target_properties(benchmark PROPERTIES COMPILE_FLAGS "-std=c++14")

README.md

+22-21
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Compare various data serialization libraries for C++.
1515
#### Build
1616
This project does not have any external library dependencies. All (boost, thrift etc.) needed libraries are downloaded
1717
and built automatically, but you need enough free disk space to build all components. To build this project you need a compiler that supports
18-
C++11 features. Project was tested with GCC 4.8.2 (Ubuntu 14.04).
18+
C++14 features. Project was tested with clang 5.0.0 (Ubuntu 16.04).
1919

2020
```
2121
$ git clone https://github.com/thekvs/cpp-serializers.git
@@ -42,29 +42,30 @@ $ ./benchmark 100000 protobuf cereal
4242
#### Results
4343

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

47-
* thrift 0.10.0
48-
* protobuf 3.1.0
49-
* boost 1.62.0
50-
* msgpack 2.1.3
51-
* cereal 1.2.1
47+
* thrift 0.12.0
48+
* protobuf 3.7.0
49+
* boost 1.69.0
50+
* msgpack 3.1.1
51+
* cereal 1.2.2
5252
* avro 1.8.2
53-
* capnproto 0.6.1
54-
* flatbuffers 1.7.1
55-
* YAS 6.0.2
53+
* capnproto 0.7.0
54+
* flatbuffers 1.10.0
55+
* YAS 7.0.2
5656

5757
| serializer | object's size | avg. total time |
5858
| -------------- | ------------- | --------------- |
59-
| thrift-binary | 17017 | 13335 |
60-
| thrift-compact | 13378 | 33205 |
61-
| protobuf | 16116 | 24717 |
62-
| boost | 17470 | 21760 |
63-
| msgpack | 13402 | 33815 |
64-
| cereal | 17416 | 11031 |
65-
| avro | 16384 | 44187 |
66-
| yas | 17416 | 3152 |
67-
| yas-compact | 13321 | 24878 |
59+
| thrift-binary | 17017 | 1190.22 |
60+
| thrift-compact | 13378 | 3474.32 |
61+
| protobuf | 16116 | 2312.78 |
62+
| boost | 17470 | 1195.04 |
63+
| msgpack | 13402 | 2560.6 |
64+
| cereal | 17416 | 1052.46 |
65+
| avro | 16384 | 4488.18 |
66+
| yas | 17416 | 302.7 |
67+
| yas-compact | 13321 | 2063.34 |
68+
6869

6970
###### Size
7071

@@ -80,8 +81,8 @@ serialize/deserialize cycle of the already built data structure.
8081

8182
| serializer | object's size | avg. total time |
8283
| -------------- | ------------- | --------------- |
83-
| capnproto | 17768 | 4849 |
84-
| flatbuffers | 17632 | 12520 |
84+
| capnproto | 17768 | 400.98 |
85+
| flatbuffers | 17632 | 491.5 |
8586

8687
![Time](images/time2.png)
8788

avro/record.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
*/
1818

1919

20-
#ifndef _HOME_NIXMAN_4_CPP_SERIALIZERS_AVRO_RECORD_HPP_3019802276__H_
21-
#define _HOME_NIXMAN_4_CPP_SERIALIZERS_AVRO_RECORD_HPP_3019802276__H_
20+
#ifndef _HOME_PKOK_CPP_SERIALIZERS_AVRO_RECORD_HPP_2710640864__H_
21+
#define _HOME_PKOK_CPP_SERIALIZERS_AVRO_RECORD_HPP_2710640864__H_
2222

2323

2424
#include <sstream>

benchmark.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <chrono>
77
#include <sstream>
88

9-
#include <boost/shared_ptr.hpp>
109
#include <boost/lexical_cast.hpp>
1110

1211
#include <thrift/transport/TBufferTransports.h>
@@ -43,8 +42,8 @@ thrift_serialization_test(size_t iterations, ThriftSerializationProto proto = Th
4342

4443
using namespace thrift_test;
4544

46-
boost::shared_ptr<TMemoryBuffer> buffer1(new TMemoryBuffer());
47-
boost::shared_ptr<TMemoryBuffer> buffer2(new TMemoryBuffer());
45+
std::shared_ptr<TMemoryBuffer> buffer1(new TMemoryBuffer());
46+
std::shared_ptr<TMemoryBuffer> buffer2(new TMemoryBuffer());
4847

4948
TBinaryProtocolT<TMemoryBuffer> binary_protocol1(buffer1);
5049
TBinaryProtocolT<TMemoryBuffer> binary_protocol2(buffer2);
@@ -95,7 +94,7 @@ thrift_serialization_test(size_t iterations, ThriftSerializationProto proto = Th
9594
tag = "thrift-compact:";
9695
}
9796

98-
std::cout << tag << " version = " << VERSION << std::endl;
97+
std::cout << tag << " version = " << PACKAGE_VERSION << std::endl;
9998
std::cout << tag << " size = " << serialized.size() << " bytes" << std::endl;
10099

101100
auto start = std::chrono::high_resolution_clock::now();

0 commit comments

Comments
 (0)