Skip to main content

Module pco

Module pco 

Source
Expand description

Pcodec (pco) — Loncaric, Pcodec: Better Compression for Numerical Sequences (2025) — as a block codec for floats and integers.

pco decomposes each number into latent variables through a “mode” (integer-multiple or float-multiple recovery, the same insight as ALP’s decimal recovery), delta-encodes them, and entropy-codes the deltas with ANS against learned bins. On the workloads this crate is measured against it compresses 3–20× better than ALP and decodes faster (tests/codec_field_check.rs prints the table), which is why it leads every adaptive candidate list. ALP and the XOR codecs stay behind it: a candidate that loses the per-block trial costs one sample encode and nothing else, and a second opinion on a codec this new is worth that.

§Wire format

[num_values: u32 LE][pco standalone file]

The count is ours, checked against the crate-wide decode ceiling before a single byte is decompressed, and the decompression writes into a buffer of exactly that size: pco’s own chunk headers are never trusted for an allocation, and a file that decodes to a different count is corrupt.

Structs§

PcoDecoder
Pcodec decoder.
PcoEncoder
Pcodec encoder for f64, i64 and u64 columns.