Skip to content
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 new variants for "compress only if comp rate at least N" #34

Closed
cowtowncoder opened this issue Nov 22, 2013 · 1 comment
Closed

Comments

@cowtowncoder
Copy link
Contributor

A relatively common use case for my own use is one where compression is only used if it makes significant difference. For example, if compression rate is only 2%, it hardly makes sense to store compressed version as there is still additional decompression overhead when reading content.

While caller can verify compression rate and choose to discard content in such case, it would be bit more efficient if library had a method that could avoid allocating result buffer in such cases. So let's add a variant or two that allows such "opportunistic" compression.

If possible, this should be added both for LZF and convenience Deflate (gzip) compression methods.

@cowtowncoder
Copy link
Contributor Author

Forgot that the only shared abstraction is Uncompressor, and that there is no block-based compressor for gzip.

So ended up just adding ChunkEncoder.appendEncodedIfCompresses(...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant