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/FastBinaryEncodingREADME
Fast Binary Encoding (FBE)
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:
- Create domain model using base types, enums, flags and structs
- Generate domain model for any supported programming languages (C++, C#, Go, Java, JavaScript, Kotlin, Python, Ruby, Swift)
- Build domain model library
- Serialize/Deserialize objects from the domain model in unified, fast and compact FastBinaryEncoding (FBE) format
- JSON convert objects from the domain model in order to use them in Web API
- Implement Sender/Receiver interfaces to create a communication protocol
Sample projects:
- C++ sample
- C# sample
- Go sample
- Java sample
- JavaScript sample
- Kotlin sample
- Python sample
- Ruby sample
- Swift sample
Contents
- Features
- Requirements
- How to build?
- Create domain model
- Generate domain model
- Build domain model
- FBE serialization
- FBE final serialization
- JSON serialization
- Packages and import
- Struct keys
- Struct numeration
- Struct inheritance
- Versioning
- Sender/Receiver protocol
- Performance benchmarks
Features
- Cross platform (Linux, MacOS, Windows)
- Generators for C++, C#, Go, Java, JavaScript, Kotlin, Python, Ruby, Swift
- Fast binary encoding format
- Supported base types (byte, bool, char, wchar, int8, int16, int32, int64, float, double)
- Supported complex types (bytes, decimal, string, timestamp, uuid)
- Supported collections (array, vector, list, map, hash)
- Supported nullable optional types, enums, flags and structs
- Serialization/Deserialization to/from binary format
- Serialization/Deserialization to/from JSON
- Sender/Receiver interfaces for communication protocols
- Versioning solution
- Excellent performance
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
node-connect
339.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
xurl
339.5kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
claude-opus-4-5-migration
83.9kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
83.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
