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

Supporting Zopfli #120

Open
jakirkham opened this issue Nov 8, 2018 · 4 comments
Open

Supporting Zopfli #120

jakirkham opened this issue Nov 8, 2018 · 4 comments

Comments

@jakirkham
Copy link
Member

jakirkham commented Nov 8, 2018

The Zopfli compression algorithm from Google is a zlib-style compression algorithm that is able to make a small, but notable improvement on the compression ratio that zlib might otherwise achieve. The catch is this ends up being quite a bit slower. However once compressed the data can be decompressed using standard zlib-style algorithms with practically unchanged decompression speed.

Generally this can be useful in cases where the data must be decompressible via zlib or gzip, compression generally happens once, and minimizing size is of paramount importance. For example, serving data used in webpages. So this could be a nice option for use cases where people are interacting tiles of image data in the web browser (via n5-wasm) for instance.

Note: There are a few Python implementations. One we might use is zopfli, which is on PyPI and conda-forge.

@jakirkham
Copy link
Member Author

cc @aschampion (in case it is of interest)

@alimanfoo
Copy link
Member

alimanfoo commented Nov 8, 2018

Sounds like a valuable addition. It looks like there are both zlib-like and gzip-like compress functions, so I guess we'd want two codecs, zopfli-zlib and zopfli-gzip. The zopfli Python package looks like it would be straightforward to wrap.

@aschampion
Copy link

Thanks for bringing this to my attention. Looks like there's a rust implementation, so when I have some time I should be able to benchmark it for n5 as I did for brotli.

At least from the rust N5 side, having a non-symmetric compression (i.e., should compress with zopfli but can decompress with normal gzip) could be a bit of an implementation pain. I'm not sure if that's easier in the zarr world. Java N5 already supports arbitrary compression schemes, so may already be able to handle this situation.

@jakirkham
Copy link
Member Author

Maybe it could be a config option on the existing codecs as opposed to new codecs?

Even if it isn't installed one could just warn and fallback to zlib or gzip. At worst one simply gets less compressed data (it is still readable).

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

No branches or pull requests

3 participants