From: Eric Biggers Date: Thu, 2 Jan 2014 05:11:59 +0000 (-0600) Subject: compress_parallel.c: Use 1 buffer per thread if chunks are big X-Git-Tag: v1.6.0~25 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=44b239c501762cbee4ac0d218b144c937e642098;ds=sidebyside compress_parallel.c: Use 1 buffer per thread if chunks are big --- diff --git a/src/compress_parallel.c b/src/compress_parallel.c index fa7f5dde..6cd306c2 100644 --- a/src/compress_parallel.c +++ b/src/compress_parallel.c @@ -423,8 +423,15 @@ new_parallel_chunk_compressor(int out_ctype, u32 out_chunk_size, desired_num_threads = num_threads; - chunks_per_msg = MAX_CHUNKS_PER_MSG; - msgs_per_thread = 2; + if (out_chunk_size < ((u32)1 << 23)) { + chunks_per_msg = MAX_CHUNKS_PER_MSG; + msgs_per_thread = 2; + } else { + /* Big chunks: Just have one buffer per thread --- more would + * just waste memory. */ + chunks_per_msg = 1; + msgs_per_thread = 1; + } for (;;) { approx_mem_required = (u64)chunks_per_msg *