From 9d1e22f743ea9ca232d39d498b675d7e5ac1ca87 Mon Sep 17 00:00:00 2001 From: AmineChikhaoui Date: Wed, 7 Feb 2018 11:18:55 +0100 Subject: [PATCH] set block size to 0 to let the lzma lib choose the right one, add some comments about possible improvements wrt memory usage/threading. --- src/libutil/compression.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libutil/compression.cc b/src/libutil/compression.cc index aad6e9b5b..a36c4405f 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)