Skip to content

Add multithreading for xz compression

Julian Groß requested to merge JulianGro/file-roller:xz-multithread into master

As I am having problems with adding multi-threading to all the other compression methods. Here the one that was straightforward.

This PR adds a function that gets you the number of threads to use. It takes all available CPU cores on 1-3 core CPUs, all available CPU cores - 1 on 4-7 core CPUs, and all available CPU cores -2 on 8 core CPUs or higher. Reasoning behind that is that on a 1-3 core machine you might not be expecting to multitask while compressing something and just want it to finish as soon as possible, on 4-7 cores you might want to do something else while compressing but expect the system to become a bit sluggish, and on 8 cores or above chances are that you expect to be able to multitask and don't want your system to slow much while compressing a big file something.

A function also makes it easy to change behaviour and/or add a setting for choosing the amount of threads later.

As this only touches the libarchive xz compression code and that one works I am pretty certain that there is no issues.

Merge request reports