Commit Graph
7 Commits
Author SHA1 Message Date
053f0b7198 Integration: level 3 instead of fast() under zlib-rs, io test into tests/it (#7689)
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>
2026-10-27 02:12:13 +01:00
Rene Leonhardt eb7e497aaf perf(compression): decode compressed slices without buffering
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.
2026-10-21 13:59:34 +02:00
Rene Leonhardt df6a7e7b5a perf(format): reduce ZIP archive allocations
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.
2026-10-21 13:59:34 +02:00
Rene Leonhardt 1121b7979b fix(format): bound ZIP expansion by declared size
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.
2026-10-20 17:59:52 +02:00
Rene Leonhardt 51788e6650 perf(format): avoid buffering compressed ZIP slices
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.
2026-10-20 17:41:28 +02:00
Rene Leonhardt a37198d4fa docs(perf): record real image deflate tradeoffs 2026-10-19 13:14:37 +02:00
Rene Leonhardt 4776d20b7a perf(compression): Use zlib-rs with runtime detection
Isolate the workspace backend choice and verify PNG, PSD and complete native-format decoding. Record standalone timing and compressed-size tradeoffs.
2026-10-19 11:31:58 +02:00