xz: Use threaded mode by defaut (as if --threads=0 was used).
This hopefully does more good than bad: + It's faster by default. + Only the threaded compressor creates files that can be decompressed in threaded mode. - Compression ratio is worse, usually not too much though. When it matters, -T1 must be used. - Memory usage increases. - Scripts that assume single-threaded mode but don't use -T1 will possibly use too much resources, for example, if they run multiple xz processes in parallel to compress multiple files. - Output from single-threaded and multi-threaded compressors differ but such changes could happen for other reasons too (they just haven't happened since 5.0.0).
This commit is contained in:
parent
a2dd2dc8e5
commit
6daa4d0ea4
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
/// Maximum number of worker threads. This can be set with
|
/// Maximum number of worker threads. This can be set with
|
||||||
/// the --threads=NUM command line option.
|
/// the --threads=NUM command line option.
|
||||||
static uint32_t threads_max = 1;
|
static uint32_t threads_max;
|
||||||
|
|
||||||
/// True when the number of threads is automatically determined based
|
/// True when the number of threads is automatically determined based
|
||||||
/// on the available hardware threads.
|
/// on the available hardware threads.
|
||||||
|
@ -334,5 +334,9 @@ hardware_init(void)
|
||||||
memlimit_mt_default = mem_ceiling;
|
memlimit_mt_default = mem_ceiling;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Enable threaded mode by default. xz 5.4.x and older
|
||||||
|
// used single-threaded mode by default.
|
||||||
|
hardware_threads_set(0);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1022,8 +1022,8 @@ message_help(bool long_help)
|
||||||
" does not affect decompressor memory requirements"));
|
" does not affect decompressor memory requirements"));
|
||||||
|
|
||||||
puts(_(
|
puts(_(
|
||||||
" -T, --threads=NUM use at most NUM threads; the default is 1; set to 0\n"
|
" -T, --threads=NUM use at most NUM threads; the default is 0 which uses\n"
|
||||||
" to use as many threads as there are processor cores"));
|
" as many threads as there are processor cores"));
|
||||||
|
|
||||||
if (long_help) {
|
if (long_help) {
|
||||||
puts(_(
|
puts(_(
|
||||||
|
|
|
@ -1303,6 +1303,15 @@ meet this condition,
|
||||||
but files compressed in single-threaded mode don't even if
|
but files compressed in single-threaded mode don't even if
|
||||||
.BI \-\-block\-size= size
|
.BI \-\-block\-size= size
|
||||||
has been used.
|
has been used.
|
||||||
|
.IP ""
|
||||||
|
The default value for
|
||||||
|
.I threads
|
||||||
|
is
|
||||||
|
.BR 0 .
|
||||||
|
In
|
||||||
|
.B xz
|
||||||
|
5.4.x and older the default is
|
||||||
|
.BR 1 .
|
||||||
.
|
.
|
||||||
.SS "Custom compressor filter chains"
|
.SS "Custom compressor filter chains"
|
||||||
A custom filter chain allows specifying
|
A custom filter chain allows specifying
|
||||||
|
|
Loading…
Reference in New Issue