Multithreaded Compression – How to Use xz on macOS

compression

Is it possible to use the multithreaded compression built into xz 5.2+ on macos? Currently using homebrew xz 5.2.3 on macos 10.12.3 with a hyperthreaded quadcore cpu and no matter my setting for number of threads in xz the compression time is always the exact same:

time xz -9vfT0 test.tar -> real 2m2.753s
time xz -9vfT8 test.tar -> real 2m1.113s 
time xz -9vfT4 test.tar -> real 2m1.034s

Best Answer

looks like it was just my filesize was too small (~160mb), when using the flag -9 anyway. It was explained to me like this:

"If you use -9, it means it uses 64 MiB LZMA2 dictionary and the default block size is 3 * dict_size = 192 MiB, a new thread is started for every 192 MiB of input."

So at -9 I would need a filesize of 1344+ MB to get all 8 cores active, each working on a >192MB block of data