All Projects → fraillt → Bitsery

fraillt / Bitsery

Licence: mit
Your binary serialization library

Programming Languages

cpp11
221 projects
cpp14
131 projects

Projects that are alternatives of or similar to Bitsery

Marklib
A small library to wrap serializable TextSelections.
Stars: ✭ 375 (-27.47%)
Mutual labels:  serialization
Ysoserial
A proof-of-concept tool for generating payloads that exploit unsafe Java object deserialization.
Stars: ✭ 4,808 (+829.98%)
Mutual labels:  serialization
Iguana
universal serialization engine
Stars: ✭ 481 (-6.96%)
Mutual labels:  serialization
Handyjson
A handy swift json-object serialization/deserialization library
Stars: ✭ 3,913 (+656.87%)
Mutual labels:  serialization
Jsoniter Scala
Scala macros for compile-time generation of safe and ultra-fast JSON codecs
Stars: ✭ 410 (-20.7%)
Mutual labels:  serialization
Flatcc
FlatBuffers Compiler and Library in C for C
Stars: ✭ 434 (-16.05%)
Mutual labels:  serialization
Leopotamgrouplibraryunity
Tools library for unity 3d game engine: animator graph helpers, serialization (json), localization, event routing (eventbus, ui actions), embedded scripting, uGui xml markup, threading, tweening, in-memory protection and other helpers (pure C#)
Stars: ✭ 373 (-27.85%)
Mutual labels:  serialization
Undom
🍩 1kb minimally viable DOM Document implementation
Stars: ✭ 496 (-4.06%)
Mutual labels:  serialization
Typesystem
Data validation, serialization, deserialization & form rendering. 🔢
Stars: ✭ 416 (-19.54%)
Mutual labels:  serialization
Elle
The Elle coroutine-based asynchronous C++ development framework.
Stars: ✭ 459 (-11.22%)
Mutual labels:  serialization
Nfx
C# Server UNISTACK framework [MOVED]
Stars: ✭ 379 (-26.69%)
Mutual labels:  serialization
Colander
A serialization/deserialization/validation library for strings, mappings and lists.
Stars: ✭ 408 (-21.08%)
Mutual labels:  serialization
Protobuf
A pure Elixir implementation of Google Protobuf
Stars: ✭ 442 (-14.51%)
Mutual labels:  serialization
Lockstepengine
A lockstep solution include lots of deterministic library (Math,Collision,Navmesh,BehaviorTree,Serialization ...)
Stars: ✭ 376 (-27.27%)
Mutual labels:  serialization
Quick Xml
Rust high performance xml reader and writer
Stars: ✭ 480 (-7.16%)
Mutual labels:  serialization
Ceras
Universal binary serializer for a wide variety of scenarios https://discord.gg/FGaCX4c
Stars: ✭ 374 (-27.66%)
Mutual labels:  serialization
Fastbinaryencoding
Fast Binary Encoding is ultra fast and universal serialization solution for C++, C#, Go, Java, JavaScript, Kotlin, Python, Ruby, Swift
Stars: ✭ 421 (-18.57%)
Mutual labels:  serialization
Protobuf Inspector
🕵️ Tool to reverse-engineer Protocol Buffers with unknown definition
Stars: ✭ 513 (-0.77%)
Mutual labels:  serialization
Binaryprefs
Rapidly fast and lightweight re-implementation of SharedPreferences which stores each preference in files separately, performs disk operations via NIO with memory mapped byte buffers and works IPC (between processes). Written from scratch.
Stars: ✭ 484 (-6.38%)
Mutual labels:  serialization
Airframe
Essential Building Blocks for Scala
Stars: ✭ 442 (-14.51%)
Mutual labels:  serialization

Bitsery

Build Status Join the chat at https://gitter.im/bitsery/Lobby

Header only C++ binary serialization library. It is designed around the networking requirements for real-time data delivery, especially for games.

All cross-platform requirements are enforced at compile time, so serialized data do not store any meta-data information and is as small as possible.

bitsery is looking for your feedback on gitter

Features

  • Cross-platform compatible.
  • Optimized for speed and space.
  • No code generation required: no IDL or metadata, just use your types directly.
  • Configurable runtime error checking on deserialization.
  • Can read/write from any source: stream (file, network stream. etc... ), or buffer (vector, c-array, etc...).
  • Don't pay for what you don't use! - customize your serialization via extensions. Some notable extensions allow:
    • fine-grained bit-level serialization control.
    • forward/backward compatibility for your types.
    • smart and raw pointers with allocators support and customizable runtime polymorphism.
  • Easily extendable for any type.
  • Allows brief (similar to cereal) or/and verbose syntax for better serialization control.
  • Configurable endianness support.
  • No macros.

Why use bitsery

Look at the numbers and features list, and decide yourself.

library data size serialize deserialize
bitsery 6913B 959ms 927ms
bitsery_compress 4213B 1282ms 1115ms
boost 11037B 9826ms 8313ms
cereal 10413B 6324ms 5698ms
flatbuffers 14924B 5129ms 2142ms
protobuf 10018B 11966ms 13919ms
yas 10463B 1908ms 1217ms

benchmarked on Ubuntu with GCC 8.3.0, more details can be found here

If still not convinced read more in library motivation section.

Usage example

#include <bitsery/bitsery.h>
#include <bitsery/adapter/buffer.h>
#include <bitsery/traits/vector.h>

enum class MyEnum:uint16_t { V1,V2,V3 };
struct MyStruct {
    uint32_t i;
    MyEnum e;
    std::vector<float> fs;
};

template <typename S>
void serialize(S& s, MyStruct& o) {
    s.value4b(o.i);
    s.value2b(o.e);
    s.container4b(o.fs, 10);
}

using Buffer = std::vector<uint8_t>;
using OutputAdapter = bitsery::OutputBufferAdapter<Buffer>;
using InputAdapter = bitsery::InputBufferAdapter<Buffer>;

int main() {
    MyStruct data{8941, MyEnum::V2, {15.0f, -8.5f, 0.045f}};
    MyStruct res{};

    Buffer buffer;

    auto writtenSize = bitsery::quickSerialization<OutputAdapter>(buffer, data);
    auto state = bitsery::quickDeserialization<InputAdapter>({buffer.begin(), writtenSize}, res);

    assert(state.first == bitsery::ReaderError::NoError && state.second);
    assert(data.fs == res.fs && data.i == res.i && data.e == res.e);
}

For more details go directly to quick start tutorial.

How to use it

This documentation comprises these parts:

documentation is in progress, most parts are empty, but contributions are welcome.

Requirements

Works with C++11 compiler, no additional dependencies, include <bitsery/bitsery.h> and you're done.

some bitsery extensions might require higher C++ standard (e.g. StdVariant)

Platforms

This library was tested on

  • Windows: Visual Studio 2015, MinGW (GCC 5.2)
  • Linux: GCC 5.4, Clang 3.9
  • OS X Mavericks: AppleClang 8

There is a patch that allows using bitsery with non-fully compatible C++11 compilers.

  • CentOS 7 with gcc 4.8.2.

License

bitsery is licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].