support multi threaded xz encoder, this might be particularly useful in

the case of hydra where the overhead of single threaded encoding is more
noticeable e.g most of the time spent in "Sending inputs"/"Receiving outputs"
is due to compression while the actual upload to the binary cache seems
to be negligible.
This commit is contained in:
AmineChikhaoui
2018-02-06 22:42:02 +01:00
parent 6f6bfc8205
commit bc7e3a4dd6
+7 -2
View File
@@ -191,8 +191,13 @@ struct XzSink : CompressionSink
XzSink(Sink & nextSink) : nextSink(nextSink)
{
lzma_ret ret = lzma_easy_encoder(
&strm, 6, LZMA_CHECK_CRC64);
lzma_mt mt_options = {};
mt_options.flags = 0;
mt_options.timeout = 300;
mt_options.check = LZMA_CHECK_CRC64;
mt_options.threads = lzma_cputhreads();
lzma_ret ret = lzma_stream_encoder_mt(
&strm, &mt_options);
if (ret != LZMA_OK)
throw CompressionError("unable to initialise lzma encoder");
// FIXME: apply the x86 BCJ filter?