Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/znippy-zoomies

ldeflate/README.md

ldeflate

Pure-Rust parallel DEFLATE/zlib compressor — the write side of linflate.

linflate reads DEFLATE fast. This writes it fast. It exists because serving or repacking a git packfile means DEFLATE-compressing thousands of objects, and before this crate there was no compression code anywhere in the znippy-zoomies workspace.

use ldeflate::{compress_objects, Config};

let objects: Vec<&[u8]> = vec![b"tree 42\0...", b"blob..."];
let streams = compress_objects(&objects, &Config::default())?;
// Each element is a complete RFC-1950 zlib stream. `git` reads them verbatim.
# Ok::<(), ldeflate::DeflateError>(())

What is parallel

Not the entropy coder — that is zlib-rs, reused unchanged. The scheduling is new, and it has two axes chosen per object by size, on one no-barrier gatling pass:

Git objects are 93.8% under 64 KiB (measured, 48 917 real objects), so they take the first path. LFS objects are megabytes, so they take the second. The same Config serves both.

Guarantees

Measured, oden (Threadripper PRO 3975WX, 32 cores), 2026-08-03

parallel cost, ~49 k real git objects, ~1.68 GiB, level 6 1.025×–1.054× the CPU of serial at 32 threads — n=7 runs, reproducible to 2.8%
efficiency vs cores actually held 94.9%–97.6% at 32 threads, over occupancies from 10.9 to 24.3 of 32 cores held
sustained 2136 MB/s across 39 consecutive passes, median 100 ms window fully saturated
ratio cost of coalescing zero — not one output byte changes
ratio cost of splitting 2.2% at the default 1 MiB segment, only on objects ≥ 4 MiB
skipping already-compressed input ≈20× less CPU (94.8%–95.6% saved) for +0.41% size, on 24 real packfiles

Why no headline “×N faster” figure. There was one — 28.30× at 32 threads — and a 7-run re-measurement on 2026-08-03 retired it as a crate claim: over those runs the 32-thread speedup ranged 10.38× to 23.20× purely with how many cores the box would give us, while the CPU cost of the schedule held to 1.025–1.054×. 28.30× was never contradicted (it is consistent with, and slightly conservative against, the re-runs), but it is unreproducible on a shared machine, so it is not quoted here as a property of the code. On a genuinely idle 32-core box the re-measured overhead predicts 30.4×–31.2×; that prediction is untested — oden has not been idle. See Finding 4b in the design doc.

Full tables, the two hypotheses these sweeps falsified, and the honest caveats: ../.nornir/ldeflate-design.md. The engine patterns it builds on, written down independently: ../.nornir/gatling-tricks.md.

When NOT to use it

License

MIT OR Apache-2.0