set block size to 0 to let the lzma lib choose the right one, add

some comments about possible improvements wrt memory usage/threading.
This commit is contained in:
AmineChikhaoui 2018-02-07 11:18:55 +01:00
parent bc7e3a4dd6
commit 9d1e22f743
No known key found for this signature in database
GPG key ID: C0C8C84C15BCCD1C

View file

@ -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)