Files
lzply/docs/INTEGRATION.md
Muse c6a13f189c integration: record fresh benchmark numbers in docs/INTEGRATION.md
bench-integration.sh (best-of-3, mixed set + 1 MiB random) plus the
codec-name fix for the intlv speed run. Headline fresh numbers:
intlv-d64 enc 3.77 / dec 1.72 MB/s at 5.40% overhead; ldpc-r90 enc
4.08 / dec 1.07 at 10.94%; recovery 1.000 on the mixed blob for all
three ECC winners. Dict is +2.7% worse on the repo-sources-only code
corpus (branch -2.1% was header-heavy code) -- recorded honestly.
2026-12-02 15:47:38 +00:00

10 KiB

Integration: experiment winners on current main (LZPL v5)

Merged onto experiments/integration at b27b345 (LZPL v5 + lz_rs + deep repair + CRC16). The three experiment branches were all based on 8dbb8d03; this integration re-bases their winners onto current main instead. The archive format is unchanged (still LZPL v5): the winners arrive as standalone tools in exp/ and experiments/, built and smoke-tested by tests/run_integration_tests.sh (hooked into make test). Wiring interleave/LDPC into lzply -e levels would be a format change (LZPL v6) and is explicitly future work, not done here.

Sources

branch tip carried over
experiments/baseline 5807281 bench/, docs/BASELINE.md (the comparison baseline)
experiments/ecc a34cd7d exp/ harness + interleave + LDPC (see below)
experiments/comp fbce346 experiments/ rANS core + dict + bchcheck (see below)

Winners (integrated)

1. Byte interleaving, depth 64, over small-block BCH (exp/)

  • What: the encoded stream (BCH, 1 KiB blocks) is permuted before it hits the channel — groups of D consecutive blocks written row-wise into a D-row matrix, read out column-wise. A burst of L bytes then hits any one block at most ceil(L/D) bytes instead of all L bytes landing in one block and killing it. Zero extra parity: a pure permutation, inverted on decode, so overhead is exactly the BCH overhead and random-error performance is unchanged.
  • Gotcha fixed on the branch: groups merge the short tail (a 4-block tail group measured 0.94 on 64 B bursts before the fix).
  • Measured (text.lz, 64 KiB windows, 200 trials/setting): intlv-d64-bch1k-t32 recovers 1.00 at burst 16/64/256 B and 1.00 at 4x64 B bursts, where uninterleaved bch1k-t32 recovers 0.00 at every burst size. Random-error performance unchanged by construction (1.00 at BER 1e-3, same as bch1k-t32). Overhead 5.40%. Even at 1.29% overhead, intlv-d64-bch1k-t8 survives 64 B bursts at 1.00.
  • Speed: interleaving costs nothing measurable (3.39 MB/s enc, 1.73 MB/s dec — same as the BCH underneath).
  • Use:
    cd exp && ./mkcorpora.sh            # build corpora/text.lz etc.
    ./bench --codec intlv-d64-bch1k-t32 --blob corpora/text.lz \
            --size 65536 --trials 200 --burst 256,1 --out results/x.csv
    

2. Small-block BCH, 1 KiB blocks (exp/)

  • What: the same BCH lzply ships, but forced to m=13 blocks (971 data bytes/block) instead of one huge block per blob. This is the "spend real redundancy" point.
  • Measured (text.lz, 64 KiB, 200 trials): bch1k-t32 recovers 1.00 at BER 1e-4 and 1e-3, 0.01 at 3e-3, at 5.40% overhead — where as-shipped bch-t32 (one 64 KiB block, 0.12% overhead) recovers 1.00 at 1e-5, 0.01 at 1e-4, 0.00 at 1e-3. Bursts still kill it without interleaving (256 B burst: 0.00 at every t).
  • Speed: bch1k-t32 2.97 MB/s enc, 1.55 MB/s dec; bch1k-t8 9.98 / 5.87 MB/s at 1.29% overhead.
  • Use:
    ./bench --codec bch1k-t32 --blob corpora/text.lz \
            --size 65536 --trials 200 --ber 1e-3
    

3. Regular LDPC, rate 0.90 (exp/)

  • What: regular LDPC, PEG construction, min-sum belief propagation. n=8192 bits, column weight 3, m=768 checks, row weight 32, k=7424 bits (928 B). Fixed seed, so the code is identical on every run and every server. Systematic encoding by Gauss-Jordan reduction of H to [I | P] (one-time, at codec creation, ~1.8 s init).
  • Measured (text.lz, 64 KiB, 200 trials): ldpc-r90 recovers 1.00 at BER 1e-3 and 0.97 at 3e-3, where bch1k-t32 recovers 0.01 at 3e-3 — the iterative decoder's cliff sits a decade higher in BER. Overhead 10.94%. Bursts kill it (16 B burst: 0.24); LDPC+interleave is the follow-up. ldpc-r95 is weak (0.32 at 1e-3, fails at 6 errors/block); irregular LDPC is the follow-up.
  • Speed: 3.34 MB/s enc, 0.91 MB/s dec — ~4x slower decode than bch1k-t32.
  • Use:
    ./bench --codec ldpc-r90 --blob corpora/text.lz \
            --size 65536 --trials 200 --ber 1e-3
    ./ldpc_diag r90 40 50               # single-block error-count sweep
    

4. Dictionary transform, code-only opt-in (experiments/)

  • What: per-file word dictionary (top 4096 words by saving, transmitted in the header), words -> 3-byte codes, then lzip -6. Format: magic DICT, u32 orig_len, u16 ndict, entries (u8 len, bytes); 0xFF escape introduces a 2-byte code.
  • Measured (8 MiB corpora, lzip -6): code 9.19% vs plain lzip6 9.38% (-2.1% better — long repeated identifiers survive as codes better than as LZ matches). Everywhere else the dictionary costs more than it saves: text 3.58 vs 3.56 (+0.5% worse), bin 33.30 vs 32.61, mixed 17.65 vs 17.41, rand worse. Not a default; a code-only optional preprocessing stage at most.
  • End-to-end BCH check (bchcheck): dict+lzip code blob (770,519 B) BCH t=8, 8 flips -> 8 corrected, full pipeline recovers bit-identical; 32 flips -> decode FAIL (beyond t=8, honest failure).
  • Use (dict takes file paths, not stdin):
    ./dict c code.c code.dict && lzip -6 code.dict
    lzip -dc code.dict.lz > code.dict2 && ./dict d code.dict2 code.c.out
    

Supporting infrastructure: rANS core (experiments/rans.[ch])

  • What: the shared entropy stage for the prototypes — static per-file freqs, 12-bit probs. Enc 30-38 MB/s, dec 47-62 MB/s, RSS ~20 MB. Kept as reusable infrastructure, not as a standalone compressor: order-0 rANS alone scores text 64.40%, code 67.62% (no LZ stage), so it is a reject as a compressor and a keep as a core. Two real bugs fixed on the branch (renormalisation threshold; emitted stream can exceed n bytes, scratch is 2n+64).
  • Use: ./rans_tool c in out / ./rans_tool d in out.

Rejects (measured, not carried over)

Only their numbers stay (in exp/README.md, experiments/README.md, experiments/results/*.csv); the code was removed in the integration cleanup commit.

family verdict numbers
Polar SC (polar-r90) dominated, rejected 0.00 at BER 1e-3 at every design point; designing for p=1e-2 gives 0.00 at 1e-4; best (d4) 0.95 at 1e-4. Dec 0.58 MB/s, slowest of all. SCL list decoding is the follow-up that could rescue it.
UEP (unequal error protection) conditional, not integrated Whole-file recovery dominated by the weak tier (0.00 at 1e-3). The 1-4 KiB prefix survives (1.00 at 1e-3, 1.00 at 256 B burst) — but only useful if lzply gains a salvage mode; today the entry SHA gates all-or-nothing extraction.
LZ77 + rANS (lzrans) rejected as a lzip replacement lazy: text 6.26, code 13.52, bin 41.84, mixed 23.15; optimal parsing recovers only ~1-3% relative — the gap is LZMA's adaptive context entropy model, not parsing.
BWT + MTF + rANS rejected text 6.35 (beats bzip2's 9.25), code 12.31, bin 42.76; loses to lzip everywhere; encode 0.05 MB/s (~3 min/8 MB), decode 5-6 MB/s, RSS ~200 MB.
PPM order-2 + arithmetic rejected text 32.84, code 30.82, mixed 39.18; ~6 MB/s enc, ~4 MB/s dec. Nowhere near PPMd-class.
rANS order-0 standalone rejected as a compressor text 64.40, code 67.62, bin 77.14 — no LZ stage. Core kept (above).

Baselines the winners were measured against

  • As-shipped BCH (bch-t32): one 64 KiB blob = one BCH block (m=20, 80 parity bytes, 0.12% overhead, 32 correctable bits per 64 KiB). Cliff between BER 1e-5 and 1e-4 (1.00 -> 0.01).
  • Pass 2 (hash-gated candidates) rescues nothing in practice: 0/875 in the pass-2 matrix, 0/50 at every k in the targeted sweep. Its demonstrated value is the loud-failure guarantee: 0 silent miscorrections in 7813 checks. See docs/BASELINE.md.
  • lzip (the current lzply stage): text 3.44-3.56%, code 9.05-9.38%, bin 32.53-32.61%, mixed 17.17-17.41% at -9..-6. No prototype family beats lzip on ratio. See experiments/README.md.

Verification on the integrated tree

  • make -j8 then make test runs the full suites (bch_test, rs_test, crc16_test, run_rs_tests.sh, run_tests.sh, run_deep_repair_tests.sh, run_hyper_tests.sh) plus 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.
  • Cross-corpus check on the branches reproduced text.lz exactly on bin.lz and rand.lz for every codec and setting.

Build

make -j8                 # main tools + lz_rs + deep repair
make exp                 # exp/bench + ldpc_diag + pass2_diag
make experiments         # experiments/rans_tool + dict + bchcheck
make test                # full suites + integration smoke tests

Fresh numbers on the integrated tree (hot_newyork, 2026-12-02)

Re-measured after the merge with bench-integration.sh (best-of-3 timings, load ~1.2-1.6). Data set: mixed dir 25,521,882 bytes (repo text + repo C sources + /bin/ls, /bin/cat, /usr/bin/lzip) + 1 MiB /dev/urandom. The lzply core is untouched by the integration, so the plain-lzply numbers below are the b27b345 numbers.

Plain lzply at b27b345:

  • lzply -c -6 mixed: 7,060,165 bytes, 22.904 s compress / 1.594 s extract
  • lzply -c -6 -e 0 mixed: 7,059,797 bytes (BCH adds 368 bytes here)
  • lzply -c -6 rand1m: 1,048,750 bytes (stored, level 0), 0.577 s / 0.060 s

exp bench --speed, mixed.lz blob (308,207 bytes), 64 KiB windows:

  • bch-t32: enc 8.59 MB/s, dec 4.28 MB/s, overhead 0.12%
  • bch1k-t32: enc 3.72 MB/s, dec 1.93 MB/s, overhead 5.40%
  • intlv-d64-bch1k-t32: enc 3.77 MB/s, dec 1.72 MB/s, overhead 5.40%
  • ldpc-r90: enc 4.08 MB/s, dec 1.07 MB/s, overhead 10.94%, init 1.87 s

Recovery on the mixed blob (fresh, reproduces the branch matrices):

  • intlv-d64-bch1k-t32, 256 B burst: 1.000 (20 trials)
  • bch1k-t32, BER 1e-3: 1.000 (20 trials)
  • ldpc-r90, BER 1e-3: 1.000 (10 trials)

Dictionary transform on this corpus (repo C sources only, 786,430 bytes): plain lzip6 120,409 vs dict+lzip6 123,662 (+2.7% worse) -- the branch -2.1% win was on header-heavy code (8 MiB of /usr/include headers + repo sources). On text (1,004,068 bytes): plain 187,798 vs dict 191,045 (+1.7% worse). The code-only conditional stands, and it is corpus-dependent: headers win, plain C sources do not.

rANS order-0 on text (1,004,068 bytes): 614,658 bytes (61.2%), enc ~31 MB/s, dec ~42 MB/s.