aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/compression.cc
diff options
context:
space:
mode:
authorAmineChikhaoui <amine.chikhaoui91@gmail.com>2018-02-06 22:42:02 +0100
committerAmineChikhaoui <amine.chikhaoui91@gmail.com>2018-02-06 22:42:02 +0100
commitbc7e3a4dd62baa99dbd1985d329a2a806d59a422 (patch)
tree7891bb70926a350c819fe612576de98583c8d7b1 /src/libutil/compression.cc
parent6f6bfc820544c3fe9cc35ec67ed3f9d4c6a293a3 (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/libutil/compression.cc')
-rw-r--r--src/libutil/compression.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libutil/compression.cc b/src/libutil/compression.cc
index 5e2631ba3..aad6e9b5b 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?