Skip to content

Commit

Permalink
Don't hard-code xz compression option "-9e". If compression level was…
Browse files Browse the repository at this point in the history
…n't hard-coded in the xz command-line used by SBT, the user would be able to set the desired compression options via environment variable XZ_OPT. But, currently, since "-9e" is hard-coded, (#1430)

the options in XZ_OPT will always be overwritten! 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. Furthermore, option "-e" easily doubles compression time for marginal improvement in compression ratio (if at all); 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.

Form the xz manpage:
- "Unless you want to maximize the compression ratio, you probably don't want a higher preset level than -7 due to speed and memory usage."
- On the '-e' option: "Modify the compression preset (-0 ... -9) so that a little bit better compression ratio can be achieved without increasing memory usage of the compressor or decompressor. The downside is that the compression time will increase dramatically (it can easily double)."

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

Co-authored-by: Nepomuk Seiler <muuki88@users.noreply.github.com>
  • Loading branch information
dEajL3kA and muuki88 committed Jul 8, 2021
1 parent 6583d70 commit ddd404e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ object Archives {
*/
def xz(f: File): File = {
val par = f.getParentFile
sys.process.Process(Seq("xz", "-9e", "-S", ".xz", f.getAbsolutePath), Some(par)).! match {
sys.process.Process(Seq("xz", /*"-9e",*/ "-S", ".xz", f.getAbsolutePath), Some(par)).! match {
case 0 => ()
case n => sys.error("Error xz-ing " + f + ". Exit code: " + n)
}
Expand Down

0 comments on commit ddd404e

Please sign in to comment.