Files
Muse f60ca9fd73 integration: wire winners into the build + tests, document in docs/INTEGRATION.md
- make exp / make experiments build the integrated winners
  (exp/bench + diags; experiments/rans_tool + dict + bchcheck)
- make test runs tests/run_integration_tests.sh: clean round-trips
  for all three ECC codecs, intlv-d64 burst survival + uninterleaved
  control, bch1k BER survival + as-shipped control, LDPC BER survival,
  rANS round-trip, dict+lzip round-trip, bchcheck 8-flip recovery and
  32-flip expected failure, LZPL v5 archive round-trip
- docs/INTEGRATION.md: the four winners with measured numbers, the
  rejects with numbers, build/test instructions
- README.md: Integrated experiments section; branch READMEs carry a
  pointer to docs/INTEGRATION.md
Archive format unchanged (LZPL v5); wiring interleave/LDPC into
lzply -e levels would be a format change and is future work.
2026-12-02 14:42:57 +00:00
..

lzply compression experiments (branch experiments/comp)

Integrated onto current main (experiments/integration, LZPL v5): the winners here are the dictionary transform (code-only) and the rANS core as infrastructure. lzrans, BWT, and PPM were measured, rejected, and their code was NOT carried over — see docs/INTEGRATION.md.

Prototypes for open-ended compression research. Each tool is standalone: tool c|o in out, tool d in out. Shared rANS core in rans.[ch]. bench.py <name> <enc> <dec> [corpora...] times (best of 3), sizes, and sha256-verifies round-trips; bench1.py is the single-run variant (for slow tools); CSVs land in results/.

Corpora (built by mkcorpora.py, deterministic per machine)

  • text: 8 MiB UTF-8 docs from /usr/share/doc + common-licenses
  • code: 8 MiB C headers (/usr/include) + this repo's sources
  • bin: 8 MiB ELF binaries from /bin + /usr/bin
  • mixed: 8 MiB round-robin 64 KiB chunks of text+code+bin
  • rand: 4 MiB /dev/urandom (seed 1234), incompressible control Corpora are NOT committed (regenerate with mkcorpora.py). All ratios below are compressed/orig %; speeds are MB/s (orig bytes).

Baseline: lzip (the current lzply stage; same liblz, same levels)

tool text code bin mixed rand enc MB/s dec MB/s
lzip -1 6.22 15.13 37.83 21.58 101.36 1.4-9.1 8.9-71.8
lzip -6 3.56 9.38 32.61 17.41 101.36 0.9-2.3 7.9-71.4
lzip -9 3.44 9.05 32.53 17.17 101.36 0.8-1.4 9.0-70.3
References: xz -6 ~= lzip -6 (text 3.51, code 9.20, bin 32.59,
mixed 17.30); zstd -19 text 3.63, code 9.48, bin 34.81, mixed 18.31;
gzip -9 text 23.48, code 16.40, bin 44.14, mixed 30.06;
bzip2 -9 text 9.25, code 12.55, bin 40.22, mixed 23.53,
dec only 5-9 MB/s.

ANS: rANS order-0 (rans_tool) — REJECT as standalone, KEEP core

Static per-file freqs, 12-bit probs. Enc 30-38 MB/s, dec 47-62 MB/s, RSS ~20 MB, but no LZ stage: text 64.40, code 67.62, bin 77.14, mixed 78.11, rand 100.46. The core is the entropy stage for the BWT and LZ prototypes below. (Two real bugs found and fixed in the core: renormalisation threshold must be (L>>12)*f<<8 or the decoder over-reads; the emitted stream can exceed n bytes, scratch is 2n+64.)

LZ77 + rANS (lzrans) — REJECT as a lzip replacement

Hash-chain finder, 1 MiB window, lazy (c) and optimal-parse (o) modes, deflate-style length codes, log2 distance codes, litlen/dist rANS streams + raw extra bits.

mode text code bin mixed rand enc dec RSS
lazy 6.26 13.52 41.84 23.15 100.48 0.5-4.4 26-73 44 MB
optimal 6.19 13.05 — — — 0.4-1.0 64-73 173 MB
Optimal parsing recovers only ~1-3% relative, so the gap is not
parsing: it is LZMA's adaptive context entropy model plus deeper
match search and a larger dictionary. A static-table rANS cannot
close a ~75% relative gap on text.

BWT + MTF + run tokens + rANS (bwt) — REJECT as a lzip replacement

Suffix array by cyclic doubling (see the linear-vs-rotation trap below), MTF, runs >=4 tokenised as (value, 256, k), 257-symbol rANS.

corpus ratio enc dec
text 6.35 177 s (0.05 MB/s) 5.3 MB/s
code 12.31 173 s 6.3 MB/s
bin 42.76 137 s 5.9 MB/s
mixed (bench running)
rand (bench running)
RSS ~200 MB. Beats bzip2 on text (6.35 vs 9.25), ~ties on code
(12.31 vs 12.55), loses on bin (42.76 vs 40.22); loses to lzip
everywhere by a wide margin. Encode is ~3 min/8 MB (doubling SA is
memory-latency-bound over 160 MB of rank arrays); decode is 5-6 MB/s
(LF-walk random access).
GOTCHA (real bug, fixed): a linear suffix sort is NOT rotation
order — "a" < "a bandana" linearly, but cyclically
"a bandanabanan" < "abanana bandan". A sentinel does not fix it
("a$" < "a bandana$" truncates the comparison). The SA must use
cyclic doubling (rank[(i+k) % n]).

PPM order-2 + arithmetic coding (ppm) — REJECT

Order-2/1/0 contexts, escape mass = distinct-symbol count, Witten-Neal-Cleary 32-bit arithmetic coder, counts updated in all levels after every symbol. RSS ~80 MB.

corpus ratio enc MB/s dec MB/s
text 32.84 6.3 3.9
code 30.82 6.3 4.1
mixed 39.18 4.8 3.2
Far behind lzip and slow: the bit-level coder plus 256-wide level
scans cost ~6 MB/s encode, ~4 MB/s decode. A simple order-2 PPM
with heavy escape mass is nowhere near PPMd-class.

Dictionary transform + lzip (dict) — CONDITIONAL, code only

Per-file word dictionary (top 4096 words by saving, transmitted in the header), words -> 3-byte codes, then lzip -6. RSS ~32 MB.

corpus dict+lzip6 plain lzip6 delta
text 3.58 3.56 +0.5% worse
code 9.19 9.38 -2.1% BETTER
bin 33.30 32.61 +2.1% worse
mixed 17.65 17.41 +1.4% worse
rand 101.73 101.36 worse
Only code wins (+2.1%): long repeated identifiers survive as codes
better than as LZ matches. Everywhere else the dictionary costs
more than it saves (lzip already captures word repeats). Not a
default; a code-only optional preprocessing stage at most.
(Gotcha fixed during the build: words are sorted by count, so the
saving filter must continue, not break, or a short frequent
word like "the" discards the whole dictionary.)

BCH end-to-end (bchcheck) — winners survive error correction

Blob -> BCH(t=8, lzply -e 4 level) -> flip N bits -> decode -> decompress -> sha256 check.

  • dict+lzip code blob (770,519 B): poly 0050, stored 770,563 (+44 B parity, 0.006%). 8 flips -> 8 corrected, full pipeline recovers bit-identical. 32 flips -> decode FAIL (exceeds t=8 per block; honest failure mode).
  • plain lzip6 code blob (787,213 B): 8 flips -> 8 corrected, recovered + decoded bit-identical.

Verdicts (bottom line)

  • No family beats lzip on ratio. lzip/LZMA's adaptive entropy model + deep match search + large dictionary is very hard to beat with a from-scratch prototype in this scope.
  • KEEP: the rANS core (fast, correct, reusable as an entropy stage).
  • CONDITIONAL: dict transform, code-only (+2.1% on code).
  • REJECT: lzrans (lazy + optimal), BWT, PPM order-2, rANS order-0 standalone. Honest negatives, numbers above.
  • Test totals: 334 timed bench invocations, all sha256-verified OK (plus ~25 manual small-input round-trips and 3 BCH runs: 2 pass, 1 expected fail at 32 flips).

Notes / environment

  • hot_newyork (172.93.49.176), 8 cores, 30 GB RAM; server load was 10-17 during the runs (shared with other agents), so absolute MB/s figures are load-dependent; ratios are exact.
  • hot_chicago verification pending: its SSH stopped accepting new sessions Dec 2 (sshd can't fork under load); a retry agent is probing every 15 min. No Chicago numbers yet.
  • The other lz_rs/deep-repair coordinator works in /opt/lzply/src and /root/lzrs-verify/lzply; untouched by this work. No Reed-Solomon was (re-)implemented here.