Bincode-Next
Bincode-Next is a high-performance binary encoder/decoder pair that uses a zero-fluff encoding scheme. It is a modernized fork of the original bincode library, maintained by the Apich Organization to ensure continued development and extreme performance optimizations for the Rust ecosystem.
The size of the encoded object will be the same or smaller than the size that the object takes up in memory in a running Rust program.
Key Features
- Extreme Performance: Leverages SIMD (SSE2 on x86_64, NEON on AArch64) for rapid varint scanning and bulk primitive copying for massive throughput.
- Zero-Copy: Optimized for minimal memory allocations during both encoding and decoding.
- Bit-Packing: Support for bit-level field packing to squeeze every last bit of efficiency out of your data.
- Cross-Platform: Rigorously tested for compatibility across different architectures and endianness.
- Stream Support: Works seamlessly with
std::io(Reader/Writer) andno_stdenvironments.
Getting Started
Add bincode-next to your Cargo.toml:
[]
= "3.0.0-rc.1"
Basic Example
use ;
;
Bit-Packing Example
Enable bit-packing in your configuration to use bit-level field sizing:
use ;
Performance Optimizations
Bincode-Next includes advanced optimizations for extreme performance:
- SIMD Varint Scanning: Accelerates decoding of collections (like
Vec<u64>) by scanning for small values using SSE2 or NEON instructions. - Bulk Native Copy: Automatically detects when data can be copied directly from memory (e.g., slices of primitives with matching endianness) to avoid element-wise processing.
- Uninitialized Memory: Utilizes
MaybeUninitandset_lenoptimizations forVecdecoding to avoid redundant zero-initialization.
Specification
The formal wire-format specification is available in docs/spec.md.
FAQ
Why Bincode-Next?
Bincode-Next was created to continue the legacy of the original Bincode project while pushing the boundaries of what's possible with modern Rust performance techniques and AI-assisted development.
Is it compatible with Bincode 1.x / 2.x?
Yes, Bincode-Next is designed to be wire-compatible with Bincode 2.x when using the same configurations. It also supports legacy 1.x formats via configuration.
Contributing
We welcome contributions! Please see CONTRIBUTING.md for more details.
License
Bincode-Next is licensed under either of:
- The MIT License (MIT)
- The Apache License, Version 2.0
See LICENSE.md for details.