Repository navigation
feat(gix-zlib): compress with sirocco with the sirocco feature - #3127
Sam Reis (srijs) wants to merge 1 commit into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude, an AI agent working with Sam Reis (@srijs), here: numbers from whole These compare Updated for
Wall time doesn't improve here:
So for these commands on this machine the gain is CPU time and disk space rather than elapsed time. 🤖 Generated with Claude Code |
`sirocco` 0.3 adds a zlib-compatible compressor whose levels compress about as well as zlib's same level, in less time. With the feature, `stream::deflate::Write` compresses with it; the standalone `Compress` API stays on `zlib-rs`, as `Decompress` does. - Encoders are reused across writers on a thread, up to two, by level: their tables are about 340 KiB, and a writer is made per object. - Input is buffered up to 1 MiB, so objects up to that size are compressed in one call; larger ones stream through that buffer. - Writes after `flush()` fail until `reset()`, as with `zlib-rs`. On git.git's objects, with a writer per object as gitoxide makes them, level 1 (loose objects) is 22% faster than `zlib-rs` with 16% smaller output, and level 6 (packs) is 1.5x as fast with 0.9% smaller output. The `zlib-sirocco` feature of `gix` and the `fast` feature of `gitoxide` now compress with it too.
94818e4 to
710cadd
Compare
This description and the change were prepared by Claude, an AI agent, working with Sam Reis (@srijs).
sirocco0.3 adds a zlib-compatible compressor. Its levels are calibrated against zlib's: each compresses about as well as zlib's same level, in less time. This PR uses it forstream::deflate::Writewhen the existingsiroccofeature is enabled, sogix'szlib-siroccoandgitoxide'sfastfeatures now compress with it as well as decompress.Changes
gix-zlibdepends onsirocco0.3.1 (was 0.2). The decompression side's API is unchanged in 0.3; the new version only adds compression.stream::deflate::Writegets a private backend:zlib-rsas before, orsiroccowith the feature. Its public API doesn't change.stream::deflate::Compressstays onzlib-rs, asDecompressdoes. It also offers a partial flush, whichsiroccodoesn't have.The
siroccobackend:siroccosize its tables to the object. Larger objects stream through that buffer.zlib-rs.flush()finishes the stream; flushing again does nothing; writing again fails with the same "stream error" untilreset().Performance
These numbers compress each object of a 10% sample of git.git's objects (42,241 objects, 845 MB) with a fresh
deflate::Write, asgix-packandgix-odbdo. They were measured on one thread on an Apple M4, best of 3 runs:zlib-rssiroccoAt level 1 that's 22% faster, with 16% smaller loose objects. At level 6 it's 1.5x as fast, with 0.9% smaller packs.
zlib-rs's level 1 compresses less than zlib's (it follows zlib-ng's fast strategy), which accounts for most of the size difference there.Tests
The new tests in
gix-zlib/tests/zlib/stream/deflate.rshold for both backends:These pass with and without the feature:
cargo test -p gix-zlib, and with--features sirocco(as in thejustfile);gix-zlibin both configurations;cargo test -p gix-odb -p gix-pack --features gix-zlib/sirocco;cargo check --bin gix --no-default-features --features max-pure,fast.On the
siroccoside, the compressor is tested and fuzzed by round-tripping its output through zlib,zlib-rs, libdeflate,miniz_oxideand its own decoder, including streams with sync and full flushes.🤖 Generated with Claude Code
https://claude.ai/code/session_0188jteQyuSCB5eSuAzNM7Lz