Home

Awesome

Build Issues MIT

What is msgpack11 ?

msgpack11 is a tiny MsgPack library for C++11, providing MsgPack parsing and serialization.
This library is inspired by json11.
The API of msgpack11 is designed to be similar with json11.

Installation

Example

MsgPack my_msgpack = MsgPack::object {
    { "key1", "value1" },
    { "key2", false },
    { "key3", MsgPack::array { 1, 2, 3 } },
};

//access to elements
std::cout << my_msgpack["key1"].string_value();

//serialize
std::string msgpack_bytes = my_msgpack.dump();

//deserialize
std::string err;
MsgPack des_msgpack = MsgPack::parse(msgpack_bytes, err);

There are more specific examples in example.cpp. Please see it.

Benchmark

Derived from schemaless-benchmarks

LibraryBinary sizetime[ms] @ Smallesttime[ms] @ Smalltime[ms] @ Mediumtime[ms] @ Largetime[ms] @ Largest
msgpack-c-pack(v2.1.4)66490.552.3843.22711.758748.20
msgpack-c-unpack(v2.1.4)218041.346.0083.09714.6411192.32
msgpack11-pack(v0.0.9)9984420.80130.041063.2410466.65136640.99
msgpack11-unpack(v0.0.9)9946013.3192.54786.737345.4399119.56

CPU : 2.6 GHz Intel Core i7
Memory : 16 GB 2133 MHz LPDDR3
Git revision : 6f6b4302b68b3c88312eb24367418b7fce81298c

Feature

Acknowledgement

License

This software is released under the MIT License, see LICENSE.txt.