-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
API request : CompressionLevel.Highest #1549
Comments
If
And the interpretation of that value is inconsistent between the zlib and Brotli implementations. In https://github.com/dotnet/corefx/issues/29555 it was concluded that I'd suggest either:
|
Yes, we should clarify the docs on Optimal. My inclination to go this direction is that |
@ericstj I can help adding this clarification to the documentation. |
I believe the implementation and document are in sync atm. We shouldn't update the docs without updating the implementation first since it looks like This, naturally, would be a breaking change. Based on this comment though, Also
|
@ericstj "We can't drastically change the behavior for existing apps or apps that recompile." |
namespace System.IO.Compression
{
public partial enum CompressionLevel
{
SmallestSize
// Existing:
// Fastest,
// NoCompression,
// Optimal
}
} |
Since you already have Fastest you could add Slowest. Pedant: maximum compression is no guarantee for the SmallestSize, it is just a guarantee that it will be slower\it will try harder. The resulting file size may be the same. |
Triage: |
Why can’t you use 0-9 like the underlying API? The ambiguity of the current options is obviously a poor choice given the confusion expressed here and elsewhere. |
0-9 isn't the only option. There are also different strategies. This enum is also shared with other compression technologies which don't have the same parameters. The purpose of the CompressionLevel enumeration is to let folks use compression algorithms without needing to understand the meaning of their tuning parameters. We've separately discussed exposing more advanced options that allow directly accessing different compression algorithm tuning parameters. We're not closed to that idea, but the CompressionLevel enum isn't the place to represent it. |
I know this.
The leaky abstraction over deflate causes more issues than it solves. It's already proven to be inconsistent and adding to it will not help solve that. I'll wager most individuals interested in working with compression algorithms want to use the APIs relevant to those algorithms. |
Currently we only have
CompressionLevel.NoCompression, CompressionLevel.Fastest, CompressionLevel.Optimal
.As discussed in https://github.com/dotnet/corefx/issues/34157 and other issues
CompressionLevel.Optimal
is not the "best" compression. It's a trade-off of CPU/resources vs final compressed size. In some cases the result is much worse than the best a compression algorithm can do.Let's let the
CompressionLevel.Optimal
continue to be the goldilocks option, and addCompressionLevel.Highest
for those who desire the absolute best compression, regardless of resource consumption.The text was updated successfully, but these errors were encountered: