How do I enable multi-threaded LZMA2 using 7-zip 9.20 on the command line?

13

5

How do I enable multi-threaded LZMA2 using 7-zip 9.20 on the command line? I know this is normally done with the -t option like so: "-tzip" .

How do I do this with LZMA2? I tried -tlzma and -tlzma2 and neither one works. I also tried not passing -t at all, and it just runs single threaded with "lzma" mode.

Here is the command I currently have, but it is slow, and single threaded:

"C:\Program Files\7-Zip\7z.exe" a -r -tzip -y XMLBackup.zip *.xml

djangofan

Posted 2012-04-04T18:40:29.713

Reputation: 2 459

Answers

11

Try -m0=lzma2

"C:\Program Files\7-Zip\7z.exe" a -m0=lzma2 -r -y XMLBackup.zip *.xml

more info

Timothy003

Posted 2012-04-04T18:40:29.713

Reputation: 292

5This combined with -mmt=x did the trick for me. It seems that if lzma2 is not specified that it uses the older lzma compression and therefore can't use multiple threads. If you specify both options, it will be able to use multithreading. – Kibbee – 2012-10-25T15:24:15.757

5

The help file says it's mt=number_of_threads

I know this is specifically about the command line, but one thing I can say about when using the GUI, as soon as you switch to LMZA2 you got all the options. And it DOES speed up compression a great deal, utilizing the full 100% of your CPU's power rather than the usual 25%.

iNGO

Posted 2012-04-04T18:40:29.713

Reputation: 51

1

7z a -txz -mx=9 -mmt=on out.tar.xz in.tar

-txz uses XZ (LZMA2)

-mx=9 sets the compression level (1 fastest / 9 best compression)

-mmt=on LZMA2 only supports up to 2 threads (either -mmt=on or -mmt=off) but multithreading is on by default

https://sevenzip.osdn.jp/chm/cmdline/switches/method.htm#XZ

clarkk

Posted 2012-04-04T18:40:29.713

Reputation: 259

0

I tried a simple 7z command without multithrading options on a windows 2012 server with 2 cpu and both cpu are working hard to compress my big file, so I think multithreading is active by default.

Alberto Lepore

Posted 2012-04-04T18:40:29.713

Reputation: 1

This was posted as an answer, but it does not attempt to answer the question. It should possibly be an edit, a comment, another question, or deleted altogether. Given the answers on this question, this is more of a comment.

– Cand3r – 2016-07-26T14:29:57.940

0

The multithreading mode is given in a -m flag, and it's apparently only implemented for zip, 7z, bzip2 and xz. More specifically, -mmt=<<# of threads>>. However, according to the documentation, it is enabled by default. See the CHM manual included with 7-zip for more information.

Jessidhia

Posted 2012-04-04T18:40:29.713

Reputation: 2 602

I tried it and didn't notice any apparent speed increase. I am not entirely convinced it works. – djangofan – 2012-04-04T20:30:50.137

How many physical cores is windows seeing in your computer? You can tell whether multithreading is being used by CPU usage; it's possible that you're already seeing the best speed and turning multithreading off just makes it even slower. – Jessidhia – 2012-04-04T23:12:10.903

I already thought of that. I opened 7-zip (version 9.20) and I looked at what it "detected" as the number of cores. That is the number I used. – djangofan – 2012-04-06T02:25:48.900