sirius
A fast, zero-allocation binary serialization/deserialization library for Rust. Sirius provides a simple derive macro to automatically implement efficient binary serialization for your structs and enums, with a focus on performance and minimal overhead.
Note: This crate originally started as
Schemouin github.com/Colabie/Colabie, but is now extracted as a standalone repository. This repo will continue to be used inColabie/Colabiefor serialization needs.
Features
- Zero-allocation: Avoids unnecessary allocations during (de)serialization.
- Derive macro: Use
#[derive(Sirius)]to auto-implement theSiriustrait for your types. - Simple API: Serialize to any
Write, or useserialize_buffered()for convenience. - Supports: Structs, enums, arrays, vectors, strings, numbers, and more.
Example
use Sirius;
Benchmarks
Sirius is designed for speed. Here are real benchmark results (run on a modern x86_64 CPU, Rust nightly):
| Type | Sirius Serialize | Sirius Deserialize |
|---|---|---|
u32 |
~1.14 ns/iter | ~1.81 ns/iter |
String (16 bytes) |
~21.17 ns/iter | ~14.66 ns/iter |
Vec<u32> (100 items) |
~267.95 ns/iter | ~271.41 ns/iter |
Note: Actual performance may vary depending on your hardware and compiler settings. For real benchmarks, run cargo +nightly bench.
License
MIT