Switch from adler2 to simd-adler32 crate when using miniz_oxide backend#492
Merged
Byron merged 2 commits intorust-lang:mainfrom Jul 3, 2025
Merged
Switch from adler2 to simd-adler32 crate when using miniz_oxide backend#492Byron merged 2 commits intorust-lang:mainfrom
Byron merged 2 commits intorust-lang:mainfrom
Conversation
Member
Author
|
CI fails because Clippy complains about code I didn't touch. |
Byron
approved these changes
Jul 3, 2025
Member
Byron
left a comment
There was a problem hiding this comment.
Thanks so much! Particularly the motivation and explanation was helpful as otherwise I would have worried that adding SIMD instructions will reduce compatibility and break downstream.
Also, I have fixed the clippy warnings, including additional ones that come up with cargo clippy --all-targets.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Switch over to https://crates.io/crates/simd-adler32 for a performance boost.
Introduces some unsafe code into the dependency tree due to the use of raw CPU intrinsics. However, this unsafe code is low risk due to the way it's structured, and the crate has also undergone extensive fuzzing.
This has been enabled in the famously risk-averse
image-pngfor a good while now, and is even enabled in the Chromium field trials on stable channel.It's worth noting that Rust v1.87 has dramatically regressed performance of lots of SIMD code relying on runtime feature etection; this negatively affected the AVX2 codepath of simd-adler32, see rust-lang/rust#142603
Which is why I didn't open this earlier.
On all other compiler versions dating back all the way to MSRV this crate is dramatically faster than adler2.