Reduce binary size: Zopfli codegen compression + percentage byte-plane#691
Merged
Conversation
Two lossless changes; musl `inspect` example 778,528 -> 770,944 B (-7,584, -0.97%). All tests and the JS-equivalence proptests pass. - Compress the generated data blobs with Zopfli instead of flate2 in the xtask codegen. Zopfli emits a standard raw-deflate stream, so the runtime `flate2::read::DeflateDecoder` reads it unchanged and no consumer-facing dependency changes (xtask is `publish = false` and is not in the crate's runtime dependency tree). Shrinks all 10 blobs 116,422 -> 109,896 B. - Store the region percentage deltas as three fixed-width byte planes (the same stream-split scheme already used for the pair indices) instead of postcard varint. Being element-addressable they reuse PAIR_RANGES, so the separate PERCENT_RANGES table is dropped (-964 B of rodata) along with the `decode::<u32>` monomorphization. RegionData collapses from 4 fields to 2.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #691 +/- ##
=======================================
Coverage 99.04% 99.04%
=======================================
Files 47 47
Lines 2413 2415 +2
=======================================
+ Hits 2390 2392 +2
Misses 23 23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2ca304f to
d2a6219
Compare
Merged
Boshen
pushed a commit
that referenced
this pull request
May 29, 2026
## 🤖 New release * `oxc-browserslist`: 3.0.3 -> 3.0.4 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [3.0.4](oxc-browserslist-v3.0.3...oxc-browserslist-v3.0.4) - 2026-05-29 ### Other - DRY up feature/region codegen with shared table + lookup helpers ([#694](#694)) - Consolidate bundled-data loading behind compression helpers ([#693](#693)) - Reduce binary size: run-length encode feature support versions ([#692](#692)) - Reduce binary size: Zopfli codegen compression + percentage byte-plane ([#691](#691)) - Reduce binary size: byte-plane (stream-split) compression for region pair indices ([#690](#690)) - Update README binary size to 621K ([#689](#689)) - Reduce binary size of bundled caniuse/electron data ([#688](#688)) - Switch codegen data source from caniuse-db to caniuse-lite ([#687](#687)) - Update browserslist ([#685](#685)) - Update rust crates ([#682](#682)) - Update browserslist ([#679](#679)) - Update browserslist ([#678](#678)) - Update browserslist ([#677](#677)) - Update browserslist ([#673](#673)) - Update browserslist ([#671](#671)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: oxc-guard[bot] <276638029+oxc-guard[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two lossless binary-size reductions. The musl
inspectexample goes 778,528 → 770,944 B (−7,584, −0.97%); macOS is unchanged (segment quantization), so the README's "621K" stays accurate. All tests and the JS-equivalence proptests pass.Zopfli for the codegen blobs (−6,526 B across all 10 blobs)
Compression happens only in the
xtaskcodegen, and DEFLATE decoding doesn't care how a valid stream was produced. So the encoder is switched from flate2'sCompression::best()to Zopfli — a deflate-compatible encoder that uses iterative optimal (shortest-path) LZ77 parsing to squeeze a few percent more from the same format.flate2::read::DeflateDecoderreads it unchanged — no format or decoder change.xtaskispublish = falseand is not in the crate's runtime dependency tree (cargo tree -e normalshows no zopfli), so no consumer-facing dependency changes.Region percentages: 3-byte byte-plane + drop PERCENT_RANGES (−1,056 B)
The region percentage deltas now use three fixed-width byte planes (low/mid/high) — the same stream-split scheme already used for the pair indices — instead of postcard varint.
PAIR_RANGES(pairs and percentages share identical per-region counts), so the separatePERCENT_RANGESoffset table is removed (−964 B of.rodata).decode::<u32>postcard monomorphization.RegionDatacollapses from 4 fields to 2.🤖 Generated with Claude Code