-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cap buffer sizes via
ZlibStream::set_max_total_output
.
Before this commit, `ZlibStream::new` would always allocate and zero out 64kB of data via `out_buffer: vec![0; 2 * CHUNCK_BUFFER_SIZE]`. After this commit, `out_buffer` is capped by the actual size of the decompressed image data. `StreamingDecoder::parse_ihdr` estimates the image size and notifies `ZlibStream` via the new `set_max_total_output` method. Impact on the runtime of the `decode/generated-png:noncompressed-8x8.png` benchmark (3 measurements): * [-24.028% -23.693% -23.460%] (p = 0.00 < 0.05) * [-23.830% -23.480% -23.200%] (p = 0.00 < 0.05) * [-21.259% -20.893% -20.618%] (p = 0.00 < 0.05)
- Loading branch information
1 parent
caa9c17
commit 0fb4f46
Showing
3 changed files
with
81 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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