-
Notifications
You must be signed in to change notification settings - Fork 177
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
Use Gzip compress level 6 #720
Conversation
Much faster and comparable quality to level 9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this will come back to haunt me when I try to import it into Google and someone's bloat detector goes off. But I'm feeling lucky.
Expect that in a few weeks I'll come back with a new version that creates a constant for the default at the top of the file, so that it is easy to change for the entire org while vendoring in the code.
Zip offers different compression algorithms and levels. For packaging, sometimes faster compression speed is more important than size. With pkg_tar, there is already the option to use a custom compressor. For pkg_zip these use case are now possible with the exposed zip compression_level and compression_type arguments in this PR. There's a new test case that verifies that the compression settings work by comparing the compressed file sizes. The default compression level is the same as recently change for pkg_tar in bazelbuild#720
Zip offers different compression algorithms and levels. For packaging, sometimes faster compression speed is more important than size. With pkg_tar, there is already the option to use a custom compressor. For pkg_zip these use case are now possible with the exposed zip compression_level and compression_type arguments in this PR. There's a new test case that verifies that the compression settings work by comparing the compressed file sizes. The default compression level is the same as recently change for pkg_tar in bazelbuild#720
Zip offers different compression algorithms and levels. For packaging, sometimes faster compression speed is more important than size. With pkg_tar, there is already the option to use a custom compressor. For pkg_zip these use case are now possible with the exposed zip compression_level and compression_type arguments in this PR. There's a new test case that verifies that the compression settings work by comparing the compressed file sizes. The default compression level is the same as recently change for pkg_tar in bazelbuild#720
Zip offers different compression algorithms and levels. For packaging, sometimes faster compression speed is more important than size. With pkg_tar, there is already the option to use a custom compressor. For pkg_zip these use case are now possible with the exposed zip compression_level and compression_type arguments in this PR. There's a new test case that verifies that the compression settings work by comparing the compressed file sizes. The default compression level is the same as recently change for pkg_tar in bazelbuild#720
Zip offers different compression algorithms and levels. For packaging, sometimes faster compression speed is more important than size. With `pkg_tar`, there is already the option to use a custom compressor, there's no similar option for `pkg_zip` yet. This PR exposes the zip `compression_level` and `compression_type` arguments for `pkg_zip`, thus enabling the use case. The list of compressions is the same as Python's `ZipFile`: https://docs.python.org/3/library/zipfile.html#zipfile.ZIP_STORED There's a new test case that verifies that the compression settings work by comparing the compressed file sizes. The default compression level is the same as in this recent change for `pkg_tar` in #720
Much faster and comparable quality to level 9
In the example below, level 9 (max) compression is 2% smaller and 50% slower compared to level 6. This is why most gzip implementations default to level 6.
BUILD.bazel
WORKSPACE.bazel
Level 6: 183MB, 36s
Level 9: 179MB, 54s
(FYI, as a note for anyone caring about performance, using an external gzip binary cut the time by a further 6s.)