A miniature VictoriaMetrics rewritten in Rust, ported line-by-line from the Go source and then optimized (SIMD/NEON) against paired benchmarks.
Current scope: lib/encoding — VictoriaMetrics' native time-series compression
(zig-zag varints, delta / double-delta, lossy nearest-delta precision reduction,
marshal-type selection, zstd block compression).
VictoriaMetrics/— shallow clone of upstream (the porting reference; gitignored)crates/encoding/— the Rust port (see RENAME-MAP.md for the Go↔Rust mapping)bench/go/— Go baseline benchmarks running upstream lib/encoding via areplacedirective, plusgen/which produces fixtures + golden parity vectorsbench/rig/— Rust benchmark rig (identical fixture inputs)fixtures/— shared bench inputs and golden vectors (regenerate:cd bench/go && CGO_ENABLED=1 go run ./gen)docs/optimizations.md— measured wins and refuted attempts
Dedicated AWS Graviton runner (quiet node). Go baseline = upstream
lib/encoding @ c620cb30 (cgo/libzstd), go1.26.5, -cpu 1; Rust = this repo
@ ffddd684, fat-LTO release. Best-of-8 both sides. Full record with watch items:
docs/benchmarks/encoding.md.
Geomean speedup (go/rust) over 18 benches: 1.93x (2.43x on Apple Silicon — NEON margins are wider there)
| bench | go ns/op | rust ns/op | go/rust |
|---|---|---|---|
| unmarshal_array/zero_const_array | 2,598 | 471 | 5.52x |
| unmarshal_array/const_array | 3,101 | 745 | 4.16x |
| unmarshal_varint64s/max134217727 | 22,089 | 6,455 | 3.42x |
| marshal_array/zero_const_array | 2,484 | 739 | 3.36x |
| marshal_array/const_array | 2,966 | 1,071 | 2.77x |
| unmarshal_varint64s/max8191 | 8,674 | 3,339 | 2.60x |
| marshal_varint64s/max134217727 | 14,312 | 6,534 | 2.19x |
| unmarshal_varint64s/max63 | 4,807 | 2,235 | 2.15x |
| marshal_varint64s/max63 | 5,129 | 2,431 | 2.11x |
| marshal_varint64s/max8191 | 8,595 | 4,713 | 1.82x |
| marshal_array/delta_const_array | 3,030 | 1,733 | 1.75x |
| unmarshal_array/delta_const_array | 3,178 | 1,994 | 1.59x |
| marshal_array/int64_array | 147,715 | 128,549 | 1.15x |
| marshal_array/gauge_array | 146,493 | 133,469 | 1.10x |
| unmarshal_varint64s/max9223372036854775807 | 48,632 | 44,173 | 1.10x |
| unmarshal_array/int64_array | 25,291 | 23,690 | 1.07x |
| unmarshal_array/gauge_array | 29,702 | 29,645 | 1.00x |
| marshal_varint64s/max9223372036854775807 | 22,892 | 22,974 | 1.00x |
The gauge/int64 array benches are dominated by zstd level 5 itself (identical libzstd on both sides), which caps their ratios; the varint and const/delta-const codecs are where the NEON kernels pay off.
cargo test -p encoding # unit + golden-parity tests
./bench/run.sh # paired Go-vs-Rust benchmark + geomean