-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Zstd support as optional and compile-time low ratio report #25
Conversation
zstd
support as optional
in that case, consider using the CI pipeline for different features too? |
Well, It's done and awaiting for your @SOF3 review. Changelog
The compression features are selectable for each flate!(pub static DATA: [u8] from "assets/009f.dat"); // default, DEFLATE
flate!(pub static DATA: [u8] from "assets/009f.dat" with zstd); // Use Zstd for this file spcifically
flate!(pub static DATA: [u8] from "assets/009f.dat" with deflate); // Explicitly use DEFLATE. |
As of now, I've pivoted to not use Cargo feature, CI changes shouldn't required. (Reverted in 957c2bf) |
I’ve also added compile-time warning for less compression binaries, so they have a visibility for compression ration for each binaries and can consider another compression method if it is not they're looking for. Also for the users want to ignore this warning, I've added |
Co-authored-by: Jonathan Chan Kwan Yin <[email protected]>
@SOF3 For the compression ratio warning, we should have discussion about:
|
10% sounds right to me. Users should be aware that include_flate does not just increase executable size — it also increases the runtime memory by doubling the required storage and hence only reasonable to use when compression ratio is sufficiently high. Might be useful to provide a deflate_if in a future (separate) feature too. |
Okay, l will work on fixing CI. |
It should be ok for now. please run the CI. |
Thanks! Will do a release later. |
Zstd (ZStandard) is a fast real-time compression algorithm.
I've added Zstd support in compression/decompression as optional. Users can select which one to use by specifying feature flags:zstd
anddeflate
.In summary, while DEFLATE is a venerable and widely adopted algorithm, Zstd provides significant advantages in speed and compression ratio, would make it a strong choice for crates or binaries that can support it.
Testing this PRSince I've modifiedCargo.toml
to not use unnecessary dependency, multiple vectors of tests needed: