-
Notifications
You must be signed in to change notification settings - Fork 161
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
docs: fix compression level range from 0-9 to 0-10 #427
Conversation
9f48867
to
ebddc67
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given current In any case the docs should say that |
I think my primary motivation came from seeing the docs itself. The documented range was different from what I found working. I didn't switch backend, and no feature flag was used other than anything out of the box. Additionally, there's no documentation for difference in compression levels coming from various backends. I think the word |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for chiming in!
It seems we have collected all the information here that would be needed to explain 'typically' in detail: zlib-ng
and libz
support levels 0-9 and miniz
support 0-10 .
I don't think any non-comment change is needed for this to be an improvement worth merging, and would appreciate if the current code-changes were removed.
When documenting best()
one could probably mention that the highest value of 9
is returned here, despite 10 also being supported by miniz
.
Noted. I'll make the necessary change and document how the compression level range changes with the choice of compression backend. Is it okay if I keep the code structure the way I have written; while changing the |
There's also another way of going about it. I could just leave things as they are, and add more context to the comment highlighting that Which version of the solution do you think is better? |
Let's go with a docs-only change please, thank you. |
I've updated the PR. Please review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
When reading this and seeing the 0-10
range, I kept thinking that maybe this UBER-compression might not be practical as it might come at the expense of extreme time or memory usage. Thus, advertising it like 10
is a number you should choose for best
compression is wrong.
So I'd be more comfortable to separate the 10
just like miniz
does, so 0-9
is 0-best
in all of them, and 10
is a single possible value for miniz
.
Thus one could write about it like "on a scale of 0-9, but for miniz
compression level 10 is also possible".
Does that make sense?
It does. Lemme make the necessary updates. |
- mention that `miniz` also provides a level 10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for bearing with me here. Now it seems to capture all we know, adding more context to the word typically
.
miniz documentation states that its level 10 is not Zlib-compatible. I understand it will produce streams that cannot be decoded by anything but |
It's too bad I didn't scroll right when looking at this, as otherwise I would have assured this information is passed on. Right now |
Would it work if in addition to the work I did earlier I mention this warning in the docs, or should I take a different approach? |
We got it sorted in #430 |
Also store the min, max, and default levels as constants. While calling
Compression::new
, assert that level is in range.What's the PR for?
The docs say that compression level falls in the range
0-9
(inclusive), however, callingCompression::new(10)
works, and there's an assertion,debug_assert!(level.level() <= 10);
insideffi::rust::DeflateBackend::make
which ensures the limit is 10.Hence the documentation is wrong. I've fixed the documentation as well as make a few minor changes.