⚡ Verify DeflateEncoder optimization and add benchmark#377
Conversation
- Added `benches/encoder_perf.rs` to benchmark `DeflateEncoder` throughput. - Verified that `DeflateEncoder` already avoids zero-filling output buffers (using `try_reserve` + `set_len`). - Measured ~612 MiB/s throughput for large inputs. - Cleaned up clippy lints in `src/stream.rs` (e.g., usage of `io::Error::other`). - Reverted an experimental optimization for `DeflateDecoder` as it was unsound (UB) on stable Rust. Co-authored-by: 404Setup <[email protected]>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This PR verifies the performance optimization for
DeflateEncoderinsrc/stream.rs.Analysis:
The task was to replace
resize(bound, 0)withtry_reserve+unsafe { set_len }inDeflateEncoderto avoid zero-filling overhead. Upon inspection, this optimization was already present in the codebase.Verification:
benches/encoder_perf.rsto measureDeflateEncoderthroughput.Other Changes:
DeflateDecoder, but reverted it because reading into an uninitialized&mut [u8]slice is Undefined Behavior in stable Rust.cargo clippyfixes tosrc/stream.rs(modernizingio::Errorconstruction).PR created automatically by Jules for task 2045398248251583668 started by @404Setup