-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Revisit BrotliStream CompressionLevel values #46595
Comments
Users are definitely going to take a dependency on this. It will become harder and harder to change this. |
Triage:
This could become a breaking change for customers already using Optimal, so we need to make sure to report this. |
To be clear, this means that if someone passes in the values 0, 1, 2, or 3 it's interpreted as the corresponding value from CompressionLevel, but if someone passes in 4 through 11, it's interpreted completely differently as the underlying compression level setting? (Also, the validation you propose is already done.) |
I went ahead with a PR that validates that values are between 0 and 11: #57440 |
I see what you mean. My idea would be confusing to users. What about a constructor that takes an integer between 0 and 11, to allow users to freely specify a valid compression level value accepted by the underlying algorithm, without using a |
That's what BrotliEncoder provides, what #1556 proposes for BrotliStream, and what #42820 discusses standardizing for all of compression. |
@carlossanlop, this was closed by #57561, but it only addressed half of this issue. Was closing it intentional? The two halves should really be addressed together. |
Two independent-but-related issues:
passes the
compressionLevel
to the function:with no argument validation. If an arbitrary level is provided, that then gets passed through as-is to the underlying library, resulting in inconsistent and potentially unexpected behavior. We should decide whether we're ok with this behavior or whether we should take a breaking change to correct it and be more like DeflateStream, which throws for an unknown value.
With the introduction of SmallestSize (#1549 (comment)) and the rationale employed for it that Optimal should really be a good balance between speed and size, we should define it closer to 6 rather than 11. The docs will also need to be updated.
The text was updated successfully, but these errors were encountered: