nx_posting_compress.nx
buildroot/runtime/nx_posting_compress.nx
about
nx_posting_compress.nx -- LIB: posting-list compression (Lucene Frame-of-Reference model) = the biggest perf+size
lever for a billion-posting sovereign index. Sorted ascending doc-ids -> per 256-doc BLOCK: store first-id absolute
+ delta-encode the rest + BIT-PACK the deltas at the block's max bit-width. A dense list (small gaps) collapses to
~2 bits/posting vs 32. Roundtrip-exact (lossless). Built + gated NOW on fixtures; runs at NAS scale over the real
index later. SIMD-decode is a later optimization; correctness first. No float. license_tier: ORIGINAL
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_posting_compress_gate.nx
structs
| none |
consts
| 8 | const PC_BLOCK: i64 = 256 |
functions
| 11 | func pc_bitwidth(maxv: i64) -> i64 { var w: i64=0; while (1 << w) <= maxv { w = w + 1 } if w==0 { w=1 } return w } called by 1: pc_compress |
| 14 | func pc_putbits(buf: *u8, bitpos: i64, v: i64, w: i64) -> i64 called by 1: pc_compress |
| 28 | func pc_getbits(buf: *u8, bitpos: i64, w: i64) -> i64 called by 1: pc_decompress |
| 42 | func pc_compress(ids: *i64, n: i64, out: *u8) -> i64 |
| 72 | func pc_decompress(inp: *u8, nbytes: i64, out_ids: *i64) -> i64 |