diff options
author | AmineChikhaoui <amine.chikhaoui91@gmail.com> | 2018-02-06T21·42+0100 |
---|---|---|
committer | AmineChikhaoui <amine.chikhaoui91@gmail.com> | 2018-02-06T21·42+0100 |
commit | bc7e3a4dd62baa99dbd1985d329a2a806d59a422 (patch) | |
tree | 7891bb70926a350c819fe612576de98583c8d7b1 /src | |
parent | 6f6bfc820544c3fe9cc35ec67ed3f9d4c6a293a3 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/libutil/compression.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libutil/compression.cc b/src/libutil/compression.cc index 5e2631ba3408..aad6e9b5bc1e 100644 --- a/src/libutil/compression.cc +++ b/src/libutil/compression.cc @@ -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? |