SkillAgentSearch skills...

FastBinaryEncoding

Fast Binary Encoding is ultra fast and universal serialization solution for C++, C#, Go, Java, JavaScript, Kotlin, Python, Ruby, Swift

Install / Use

/learn @chronoxor/FastBinaryEncoding

README

Fast Binary Encoding (FBE)

Awesome C++ License Release <br/> Linux (clang) Linux (gcc) MacOS <br/> Windows (Cygwin) Windows (MSYS2) Windows (MinGW) Windows (Visual Studio)

Fast Binary Encoding allows to describe any domain models, business objects, complex data structures, client/server requests & responses and generate native code for different programming languages and platforms.

Fast Binary Encoding documentation<br/> Fast Binary Encoding downloads<br/> Fast Binary Encoding specification

Performance comparison to other protocols can be found here:

| Protocol | Message size | Serialization time | Deserialization time | | :-------------------------------------------------------------------: | -----------: | -----------------: | -------------------: | | Cap'n'Proto | 208 bytes | 558 ns | 359 ns | | FastBinaryEncoding | 234 bytes | 66 ns | 82 ns | | FlatBuffers | 280 bytes | 830 ns | 290 ns | | Protobuf | 120 bytes | 628 ns | 759 ns | | JSON | 301 bytes | 740 ns | 500 ns |

Typical usage workflow is the following:

  1. Create domain model using base types, enums, flags and structs
  2. Generate domain model for any supported programming languages (C++, C#, Go, Java, JavaScript, Kotlin, Python, Ruby, Swift)
  3. Build domain model library
  4. Serialize/Deserialize objects from the domain model in unified, fast and compact FastBinaryEncoding (FBE) format
  5. JSON convert objects from the domain model in order to use them in Web API
  6. Implement Sender/Receiver interfaces to create a communication protocol

Sample projects:

Contents

Features

Requirements

Optional:

How to build?

Linux: install required packages

sudo apt-get install -y binutils-dev uuid-dev flex bison

MacOS: install required packages

brew install flex bison

Windows: install required packages

choco install winflexbison3

Install gil (git links) tool

pip3 install gil

Setup repository

git clone https://github.com/chronoxor/FastBinaryEncoding.git
cd FastBinaryEncoding
gil update

Linux

cd build
./unix.sh

MacOS

cd build
./unix.sh

Windows (Cygwin)

cd build
unix.bat

Windows (MSYS2)

cd build
unix.bat

Windows (MinGW)

cd build
mingw.bat

Windows (Visual Studio)

cd build
vs.bat

Create domain model

To use Fast Binary Encoding you should provide a domain model (aka business objects). A domain model is a set of enums, flags and structures that relate to each other and might be aggregated in some hierarchy.

Fast Binary Encoding (FBE) format specification

There is a sample domain model which describes Account-Balance-Orders relation of some abstract trading platform:

// Package declaration
package proto

// Domain declaration
domain com.chronoxor

// Order side declaration
enum OrderSide : byte
{
    buy;
    sell;
}

// Order type declaration
enum OrderType : byte
{
    market;
    limit;
    stop;
}

// Order declaration
struct Order
{
    [key] int32 uid;
    string symbol;
    OrderSide side;
    OrderType type;
    double price = 0.0;
    double volume = 0.0;
}

// Account balance declaration
struct Balance
{
    [key] string currency;
    double amount = 0.0;
}

// Account state declaration
flags State : byte
{
    unknown = 0x00;
    invalid = 0x01;
    initialized = 0x02;
    calculated = 0x04;
    broken = 0x08;
    good = initialized | calculated;
    bad = unknown | invalid | broken;
}

// Account declaration
struct Account
{
    [key] int32 uid;
    string name;
    State state = State.initialized | State.bad;
    Balance wallet;
    Balance? asset;
    Order[] orders;
}

Generate domain model

The next step is a domain model compilation using 'fbec' compiler which will create a generated code for required programming language.

The following command will create a C++ generated code:

fbec --c++ --input=proto.fbe --output=.

All possible options for the 'fbec' compiler are the following:

Usage: fbec [options]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -h HELP, --

Related Skills

View on GitHub
GitHub Stars951
CategoryDevelopment
Updated2d ago
Forks98

Languages

C++

Security Score

100/100

Audited on Mar 26, 2026

No findings