Different compression methods in 7zip: Which is best suited for what task?

56

19

enter image description here

So there are different compression methods in 7zip. Which method is best suited for what task?

For example: One difference between LZMA and LZMA2 is I can choose all my cpu cores, whereas in LZMA 2 cores is the max.

Grumpy ol' Bear

Posted 2012-06-03T07:08:41.063

Reputation: 5 313

@akira link takes to a parked domain now. – Serious – 2017-11-16T10:03:23.990

1

benchmarks of compression algorithms : http://compressionratings.com/sort.cgi?rating_sum.brief+4n

– akira – 2012-06-03T08:19:20.210

Answers

23

Use LZMA 2 unless you are looking to extract the archive on a system that cannot deal with LZMA 2 archives.

Generally speaking most modern compression algorithms give roughly the same compression, and with regard to the number of cores that you can use at once, it is up to you to decide how many you want to use. Generally speaking (unless you are creating large archives) there is no reason to need more than one though. In addition, with multiple cores doing the compression, the bottleneck may become the hard drive.

soandos

Posted 2012-06-03T07:08:41.063

Reputation: 22 744

3side note: the better compression results ("ultra") are mostly bought by cpu and (important) ram. lzma2-ultra-dictsize(64mb)-4threads will eat 2+gb of ram, bzip2-ultra-dictsize(900kb) will eat 69mb of ram. – akira – 2012-06-03T08:17:46.530

13

Lzma2 is faster when using 4 or more cores and it gives better compression. This document explains it all.

Serious

Posted 2012-06-03T07:08:41.063

Reputation: 1 465

5I'm not saying the document is unusable, but it has a range of problems. Prominently, the author does not even specify what kind of data is being compressed (text? pictures? encrypted data?), does not use relative sizes where applicable and does not seem to understand solid archives at all. – mafu – 2016-05-16T13:24:51.067

You forgot to mention that using Lzma2 gives worse compression when using 4 or more threads. This is because the work is split up. From personal experience I think the best compression rate can be achieved with Lzma2 running on 3 or less threads. – Robert – 2020-02-07T00:18:44.390

5

7-Zip (at least as of 2019-09-27) has a built-in Help document with a very, very nice explanation of the various settings you can choose and what, in general, each is good for.

There's no benchmark results or anything, but it was enough information to instill some confidence in me that I was picking "good enough" and not "accidentally awful" settings.

The Help document is available through the 7-Zip File Manager as well as the Add to Archive dialog box.

The "Contents" path to the page I found useful (which opens up directly from the Add to Archive dialog box) is:

File Manager / Plugins / 7-Zip / Add to Archive Dialog Box

enter image description here

Here is a rough copy/paste of the compression method section:

Method Description

  • LZMA
    • It's base compression method for 7z format. Even old versions of 7-Zip can decompress archives created with LZMA method. It provides high compression ratio and very fast decompression.
  • LZMA2
    • Default compression method of 7z format. LZMA2 is LZMA-based compression method. It provides better multithreading support than LZMA. But compression ratio can be worse in some cases. For best compression ratio with LZMA2 use 1 or 2 CPU threads. If you use LZMA2 with more than 2 threads, 7-zip splits data to chunks and compresses these chunks independently (2 threads per each chunk).
  • PPMd
    • Dmitry Shkarin's PPMdH algorithm with small changes. Usually it provides high compression ratio and high speed for text files.
  • BZip2
    • Standard compression method based on BWT algorithm. Usually it provides high speed and pretty good compression ratio for text files.
  • Deflate
    • Standard compression method of ZIP and GZip formats. Compression ratio is not too high. But it provides pretty fast compressing and decompressing. Deflate method supports only 32 KB dictionary.
  • Deflate64
    • Modified version of Deflate algorithm with bigger dictionary (64KB).

William

Posted 2012-06-03T07:08:41.063

Reputation: 317

Great find. I never knew why my files compressed with LZMA2 were about 2% bigger than compressed with LZMA. Now reducing the number of threads from 32 to 2 they get even about 1% smaller. :) – Robert – 2020-02-06T22:47:09.883

4

Take a look here: http://www.maximumcompression.com/data/summary_mf2.php#data and sort by efficiency. I personally wish FreeArc was built into 7-zip, and do use it sometimes.

Daniel Sokolowski

Posted 2012-06-03T07:08:41.063

Reputation: 651

1Wouldn't it make more sense to sort by compression ratio? – Hashim – 2018-12-05T00:39:29.613