What is YaFF and when should you use it?
mainYaFF (Yet another Flat Format) is a high-performance C++ serialization library designed to provide a zero-copy wire format for the Protobuf ecosystem. It uses .proto files as the single source of truth but changes the physical data representation to eliminate runtime overhead.
Key Characteristics
- Zero-copy: No parsing or copying is required on read; data can be read directly from memory-mapped files.
- Protobuf Interoperability: Maintains compatibility with the Protobuf ecosystem, allowing you to use existing
.protoschemas. - High Performance: Uses adaptive layout strategies to bring field access performance close to native C++ structs.
Use Cases
Use YaFF if you:
- Want faster reads while staying within the Protobuf ecosystem.
- Need the lowest possible read overhead in performance-critical (hot) paths.
- Require zero-copy benefits (e.g., reading directly from a buffer or memory-mapped file).
- Control both the producer and consumer sides of the data pipeline within a trusted system.