4

7-zip has a command line switch to set the compression method, -m followed by a number, e.g.
-m0=LZMA.

What does the number (0 in the example) mean? Different numbers produce slightly different compression results and performance:

Parameters                      Wall    User    System
-m0=LZMA -mx=9 -ms=on -mmt=off  28.4    27.48   0.85
-m1=LZMA -mx=9 -ms=on -mmt=off  27.45   33.06   0.90
-m0=LZMA -mx=9 -ms=on -mmt=on   12.74   24.39   1.14
-m1=LZMA -mx=9 -ms=on -mmt=on   15.08   33.14   1.28
-m0=LZMA -mx=9 -ms=on -mmt=off  26.5    25.58   0.65
-m1=LZMA -mx=9 -ms=on -mmt=off  27.07   32.84   0.87
-m0=LZMA -mx=9 -ms=on -mmt=on   13.27   24.99   1.00
-m1=LZMA -mx=9 -ms=on -mmt=on   15.32   33.28   1.47
2
  • Does the time to run each command replicated exactly after every run? I don't believe changing the -m0 or -m1 would make a difference as (to the best of my knowledge after reading through the 7zip documentation) the -m{n} are simply to indicate the sequence of method you use to compress, and various filters that you can apply. So the -m{n} make sense if you use more than 1 in a single command line. If you only use 1, it shouldn't make any difference.
    – Darius
    Oct 25, 2013 at 4:47
  • Yep, I'd say somehow reproducible. I replaced the output with a table where I repeated the set. I noticed that with -m1 the CPU time is more than the wall time, so there must be some multithreading at work.
    – AndreKR
    Oct 25, 2013 at 9:07

1 Answer 1

2

That number lets you set the order of the compression operations if you are using more than one at once.

This is an example from the documentation:

7z a a.7z *.exe *.dll \
    -m0=BCJ2 -m1=LZMA:d25 -m2=LZMA:d19 -m3=LZMA:d19 \
    -mb0:1 -mb0s1:2 -mb0s2:3

adds *.exe and *.dll files to archive a.7z using BCJ2 filter, LZMA with 32 MB dictionary for main output stream (s0), and LZMA with 512 KB dictionary for s1 and s2 output streams of BCJ2.

The first compression is the lowest number, which is zero. In this example, zero is set to BCJ2. Then comes one, which is LZMA. Two and three are also LZMA, but they are using different d parameters.

The -mb option is used to "bind" the output from one compression to the input of another one. In this example, BCJ2 has one input and four outputs. Output zero is going to compression number one. Output one is going to compression number two. Output two goes to compression number three. Output three is not bound (because it does not need to be compressed again).


In your examples, they are only using one compression operation, so it does not matter which number you assign to it.

2
  • 1
    See my updated question for more numbers. As far as I understand the filter (BCJ2 in this case) splits up .exe files, right? I am compressing PDFs here, so maybe it can do something with those, too?
    – AndreKR
    Oct 25, 2013 at 9:09
  • I would think no, since PDF and EXE are different things. Oct 25, 2013 at 13:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .