about summary refs log tree commit diff
path: root/src/libutil/compression.cc
diff options
context:
space:
mode:
authorAmineChikhaoui <amine.chikhaoui91@gmail.com>2018-02-07T10·18+0100
committerAmineChikhaoui <amine.chikhaoui91@gmail.com>2018-02-07T10·18+0100
commit9d1e22f743ea9ca232d39d498b675d7e5ac1ca87 (patch)
treea24a8f6637d3725f04bc779ad9976d41ace56e08 /src/libutil/compression.cc
parentbc7e3a4dd62baa99dbd1985d329a2a806d59a422 (diff)
set block size to 0 to let the lzma lib choose the right one, add
some comments about possible improvements wrt memory usage/threading.
Diffstat (limited to 'src/libutil/compression.cc')
-rw-r--r--src/libutil/compression.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libutil/compression.cc b/src/libutil/compression.cc
index aad6e9b5bc1e..a36c4405f8bb 100644
--- a/src/libutil/compression.cc
+++ b/src/libutil/compression.cc
@@ -193,9 +193,14 @@ struct XzSink : CompressionSink
     {
         lzma_mt mt_options = {};
         mt_options.flags = 0;
-        mt_options.timeout = 300;
+        mt_options.timeout = 300; // Using the same setting as the xz cmd line
         mt_options.check = LZMA_CHECK_CRC64;
         mt_options.threads = lzma_cputhreads();
+        mt_options.block_size = 0;
+        if (mt_options.threads == 0)
+            mt_options.threads = 1;
+        // FIXME: maybe use lzma_stream_encoder_mt_memusage() to control the
+        // number of threads.
         lzma_ret ret = lzma_stream_encoder_mt(
             &strm, &mt_options);
         if (ret != LZMA_OK)