zlib-rs maps level 1 to deflate_quick, which writes static Huffman blocks
only, so every Compression::fast() caller (PDF export and print, brush
presets, PNG Fast) wrote 5-32% bigger streams than miniz's level 1 did.
Level 3 is the lowest level that is never bigger than miniz level 1 on the
docs/images photos, raw and Up-filtered (level 2 was +0.9% on one); it is
0-16% smaller and takes 1.2-3.4 times as long. The new test exports a
noisy-gradient RGB document as PDF and checks the image stream against
miniz level 1 of the same samples: 603007 vs 547315 bytes with fast(),
passes with level 3. The PR's doc no longer says the levels are unchanged.
Main moved the io integration tests into crates/io/tests/it/, so the new
deflate_compatibility.rs moves there and uses crate::common.
Co-authored-by: Rene Leonhardt <65483435+reneleonhardt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use the buffered-input decoders directly for Affinity zlib entries, deep
EXR ZIP chunks and SVGZ data already held in memory. This avoids a 32 KiB
input allocation and copy per decoder.
Keep output limits and checksum handling, with coverage for truncated
EXR streams and concatenated SVG gzip members.
Reserve complete bundles and directories from compressed sizes, and borrow
UTF-8 entry paths in the lookup index. Preserve lossy names and first-entry
lookup for duplicates.
Check ZIP field lengths before writing, bound metadata reservations, and
cover byte equivalence, overflow and incremental saves. ZIP entry paths
have a format limit independent of filesystem path constraints.
Stop after one byte beyond the declared output length. This avoids expanding a forged entry up to the caller’s larger budget.
Add tests for surplus output, empty streams and truncated endings. Clarify that the backend timings do not measure the ZIP changes.
Decode archive slices directly to remove a 32 KiB input allocation and its compressed-data copies. Preserve size limits and CRC checks, with an equivalence and corruption test. Remove the unused synthetic timing test and refresh the performance notes with public x86 evidence.