Files
pdfcraft/crates/optimize/tests
Guillem Hermida 833d6546f0 optimize: the JPEG header scan stops at the first stray byte (#1201 review)
Optimize reads a JPEG's header again for every group of fragments it tries,
and one image can be drawn many times. The scan skipped stray bytes between
segments one at a time, so a JPEG with megabytes of them after SOI cost a
full walk on every call: 64 references to one such image delayed the first
progress call by seconds.

The scan now treats a stray byte as an unreadable header, which leaves the
image as it is, and stops after 4096 markers and fill bytes. Each step jumps
over a whole segment, so the work no longer grows with the stream's size.
2026-10-23 09:40:50 +02:00
..