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

Optionally use Zopfli on the trace data #294

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jakirkham
Copy link
Member

Provides the option to use Zopfli to perform gzip compression on the trace data for the ROI Trace plots. By default this is disabled as Zopfli can be quite a bit slower than zlib and it does not provide that much more compression. However it can be useful to do a bit more compression on data that might be around for a while and/or doesn't quite fit some size constraints (e.g. an email attachment).

As the data is still gzip compressed, it is possible to perform gzip decompression as usual. Also performance of decompression is basically unchanged as well. Given this Pako, is still used as is to handle decompression in JavaScript.

" with gzip.GzipFile(fileobj=compressed, mode=\"wb\", compresslevel=compresslevel) as compressor:\n",
" compressor.write(data)\n",
" return compressed.getvalue()\n",
"def gzip_compress(data, compresslevel=6, use_zopfli=False):\n",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May want to toy with how these are exposed to the user.

@jakirkham jakirkham force-pushed the use_zopfli branch 2 times, most recently from 49a751f to 17cd7eb Compare November 27, 2018 02:24
Adds the `zopfli` dependency so as to utilize Python bindings to
Google's Zopfli library. It can achieve a slightly higher compression
ratio than zlib while still storing the data in a format usable by zlib
or gzip decompression algorithms. This can help us compress our trace
data a little better before generating the HTML ROI Trace plot.
Expose the zlib compression level for the traces in the ROI trace plot
as a parameter at the top of the cell.
Includes an option to use Zopfli to perform gzip compression. This can
make a small though notable improvement in compression size of the data.
Though can take a bit longer to run. As the data is still gzip
compressed, it can still be decompressed with any gzip implementation
like Pako. So no other changes are needed to handle the data.
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

Successfully merging this pull request may close these issues.

1 participant