Repository navigation
Make the zstd level and window size configurable for tar.zst archives
#7193
Closed
brodyhoskins
started this conversation in
Ideas, Issue Triage, and General discussions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
GoReleaser compresses
tar.zstarchives at the default speed of the zstd encoder, which is about zstd level 3. GoReleaser compressestar.gzarchives at gzip level 9. Because of this, ourtar.zstarchives are often larger than ourtar.gzarchives.The archive for
linux-amd64in mailcloak v0.0.1 is an example. It contains two stripped Go binaries that share most of their code. These are the sizes:tar.gztar.zstzstd -11zstd -11 --long=27zstd -19 --long=27Most of the gain comes from the window size. The second binary starts more than 8 MiB into the tar, so the default window cannot reach the first binary. With a 128 MiB window (
--long=27), zstd stores the shared code one time. The standardzstd -dcommand decompresses these files with no extra flags, because 128 MiB is the largest window the decoder accepts by default.Release: https://github.com/brodyhoskins/mailcloak/releases/tag/v0.0.1
Solution
Add a setting for the zstd encoder level and the window size of
tar.zstarchives. For example:These settings map to
zstd.WithEncoderLevelandzstd.WithWindowSizein github.com/klauspost/compress/zstd. If you do not set them, GoReleaser keeps the current output.All reactions