sbt / sbt-native-packager

sbt Native Packager
https://sbt-native-packager.readthedocs.io/en/stable/
BSD 2-Clause "Simplified" License
1.6k stars 441 forks source link

Don't hard-code xz compression option "-9e". If compression level was… #1430

Closed dEajL3kA closed 3 years ago

dEajL3kA commented 3 years ago

Don't hard-code compression option -9e in the xz command-line used by SBT.

If the compression options weren't hard-coded, the user would be able to set the desired compression options via environment variable XZ_OPT. But, currently, since -9e is hard-coded, the options in XZ_OPT will always be overwritten by the actual xz command-line! Also -9e is not a good default to begin with. Level -9 is very slow and needs a whole lot memory (can cause OOM killer to kill your build process!) for probably only a little improvement in compression ratio, compared to the default compression level. Furthermore, and even worse, option -e easily doubles compression time for marginal improvement in compression ratio (if at all). Option -e, that's really something you'd use if don't care about compression time at all. IMHO it really makes much more sense to just use the xz defaults and let the user override them, via XZ_OPT environment variable, if desired.

...either that, or give the use a way to set the xz compression options in the build.sbt file (please see my ticket for details).


Form the xz manpage:

https://linux.die.net/man/1/xz


This fixes #1426.

lightbend-cla-validator commented 3 years ago

Hi @dEajL3kA,

Thank you for your contribution! We really value the time you've taken to put this together.

Before we proceed with reviewing this pull request, please sign the Lightbend Contributors License Agreement:

https://www.lightbend.com/contribute/cla