commit:     6834e464803b5ac98f8ab1bbca5379970b5bc6d9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 21 01:32:17 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct 21 01:32:17 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=6834e464

ecompress: don't set -9 for xz

>From xz(1):
"""
The differences between the presets are more significant than with gzip(1) and 
bzip2(1).  The selected compression settings determine the memory requirements 
of the decompressor, thus  us‐
ing  a too high preset level might make it painful to decompress the file on an 
old system with little RAM.  Specifically, it's not a good idea to blindly use 
-9 for everything like it of‐
ten is with gzip(1) and bzip2(1).
[...]
-7 ... -9
     These are like -6 but with higher compressor and decompressor memory 
requirements.  These are useful only when compressing files bigger than 8 MiB, 
16 MiB, and 32 MiB, respectively.
[...]
•  DictSize  is  the  LZMA2 dictionary size.  It is waste of memory to use a 
dictionary bigger than the size of the uncompressed file.  This is why it is 
good to avoid using the presets -7
... -9 when there's no real need for them.  At -6 and lower, the amount of 
memory wasted is usually low enough to not matter.
"""

Most things that ecompress touches are tiny (<32MB certainly). I made the
mistake the man page warngs about -- don't assume it's a good idea just
because of gzip & bzip2, and that's exactly what I did!

Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/ecompress | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/ecompress b/bin/ecompress
index 78a53ccac..609814cca 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -128,7 +128,7 @@ if [[ ${PORTAGE_COMPRESS_FLAGS+set} != "set" ]] ; then
                # See: https://bugs.gentoo.org/672916
                # Setting '--rm' will remove the source files after a 
successful compression.
                lz4)  PORTAGE_COMPRESS_FLAGS="-m --rm";;
-               xz)   PORTAGE_COMPRESS_FLAGS="-9 -T$(___makeopts_jobs) 
--memlimit-compress=50% -q";;
+               xz)   PORTAGE_COMPRESS_FLAGS="-q -T$(___makeopts_jobs) 
--memlimit-compress=50%";;
                zstd) PORTAGE_COMPRESS_FLAGS="-q --rm -T$(___makeopts_jobs)";;
        esac
 fi

Reply via email to