riegeli-rs
A pure-Rust implementation of Google's Riegeli/records file format. Riegeli is a seekable, compressed record store designed for high-throughput sequential reads and writes, commonly used in machine learning pipelines and large-scale data processing. This crate is byte-level compatible with the C++ reference implementation.
The repository contains two crates: riegeli, the published library, and
riegeli-ffi, an internal test harness that builds the C++ reference
implementation for differential testing — it is never published and is not
for external use.
Quick start
[]
= "0.2"
use Cursor;
use ;
// Write
let mut buf = Vecnew;
let opts = new.compression;
let mut writer = new.unwrap;
writer.write_record.unwrap;
writer.write_record.unwrap;
writer.write_record.unwrap;
writer.close.unwrap;
// Read
let mut reader = new.unwrap;
while let Some = reader.read_record.unwrap
Benchmarks
See riegeli/benches/README.md for the full
head-to-head Rust vs. C++ benchmark matrix. Representative results on Linux
x86-64 (10 000 records, large payload):
| Config | Rust write | Rust read | C++ write | C++ read |
|---|---|---|---|---|
| simple+none | 1343 MB/s | 2778 MB/s | 752 MB/s | 1396 MB/s |
| simple+zstd:3 | 1996 MB/s | 2994 MB/s | 3444 MB/s | 5849 MB/s |
| transpose+none | 950 MB/s | 1613 MB/s | 706 MB/s | 1185 MB/s |
| transpose+zstd:3 | 1502 MB/s | 1607 MB/s | 2881 MB/s | 4021 MB/s |
C++ read throughput is measured through the FFI bridge and includes a per-record copy across the boundary, making it lower than native C++ performance.
License
Apache-2.0