I'm testing 7zip for compressing virtual machine images. I run these with fixed (pre-allocated) disks for performance reasons, and defrag/zero free space before compressing them (this generally makes a significant difference to the final size). I started each test below with the same 8GB VMware virtual disk containing Windows XP, Delphi 7.1 and not a lot else. These tests ran on a dual Xeon machine with 2GB RAM that was not doing anything else while the tests ran. I set the command prompt to display time and date, then ran a batch file with the output redirected to record times and commands. The batch file and raw output are in this file. After running for 40 hours WinRk crashed, leaving a 1GB temp file behind. I'm not interesting in continuing with that program. I've also run tests on other random files.
output filename | proc % | global secs | Global time | GB | % size |
---|---|---|---|---|---|
cube | 8.000 | 1.000 | |||
cube-1.gz | 56% | 388 | 00:06:28 | 1.571 | 0.196 |
cube-5.gz | 65% | 480 | 00:08:00 | 1.484 | 0.186 |
cube-1.bz2 | 71% | 1434 | 00:23:54 | 1.474 | 0.184 |
cube-9.gz | 90% | 666 | 00:11:06 | 1.474 | 0.184 |
cube-5.bz2 | 77% | 1932 | 00:32:12 | 1.449 | 0.181 |
cube-7.bz2 | 77% | 2138 | 00:35:38 | 1.446 | 0.181 |
cube-8.bz2 | 77% | 2206 | 00:36:46 | 1.445 | 0.181 |
cube-9.bz2 | 78% | 2228 | 00:37:08 | 1.443 | 0.180 |
VMware8GB.rar | 99% | 4055 | 01:07:35 | 1.380 | 0.173 |
VMware8GB-1.7z | 97% | 1057 | 00:17:37 | 1.380 | 0.173 |
VMware8GB-2.7z | 97% | 1061 | 00:17:41 | 1.380 | 0.173 |
VMware8GB-3.7z | 97% | 1067 | 00:17:47 | 1.380 | 0.173 |
VMware8GB.rar | 101% | 5767 | 01:36:07 | 1.250 | 0.156 |
VMware8GB-4.7z | 97% | 1079 | 00:17:59 | 1.226 | 0.153 |
VMware8GB-5.7z | 171% | 3341 | 00:55:41 | 1.226 | 0.153 |
VMware8GB-9c.7z | 101% | 8010 | 02:13:30 | 1.197 | 0.150 |
VMware8GB-6.7z | 171% | 3320 | 00:55:20 | 1.168 | 0.146 |
VMware8GB-7.7z | 161% | 6177 | 01:42:57 | 1.168 | 0.146 |
VMware8GB-8.7z | 161% | 6177 | 01:42:57 | 1.114 | 0.139 |
VMware8GB-9.7z | 140% | 7127 | 01:58:47 | 1.112 | 0.139 |
VMware8GB-9-27-2-32.7z | 139% | 7059 | 01:57:39 | 1.049 | 0.131 |
VMware8GB-9-27-1-64.7z | 128% | 6884 | 01:54:44 | 1.048 | 0.131 |
VMware8GB-9-27-2-64.7z | 141% | 6061 | 01:41:01 | 1.046 | 0.131 |
VMware8GB-9-27-2-255.7z | 149% | 11560 | 03:12:40 | 1.045 | 0.131 |
VMware8GB-9-27-2-128.7z | 147% | 7791 | 02:09:51 | 1.045 | 0.131 |
VMware8GB-9d.7z | 103% | 3117 | 00:51:57 | 1.032 | 0.129 |
VMware8GB-9a.7z | 154% | 17811 | 04:56:51 | 1.027 | 0.128 |
VMware8GB-9b.7z | 156% | 7146 | 01:59:06 | 1.027 | 0.128 |
~rk0000.~t~ | 59% | 137649 | 38:14:09 |
The command line I used always started with -md= 27 to give a dictionary size of 128MB and use 1.3Gb of RAM while compressing. The - mmt option to use both processors (and almost halve the compression time). The results with multiple dashed numbers all had -mx9 (maximum compression) but varied other parameters. The last command line in order: 7z a -mx9 -mmt -md=27 -ma=2 -mfb= 255) where a= [0|1|2] Sets compressing mode and fb=[5..255] sets number of fast bytes for LZMA. Help on that: Default value is 32 for normal mode and 64 for maximum mode. Usually big number gives a little bit better compression ratio and slower compression process. The Proc % column is processor utilisation - over 100% means the compressing program was using both processors in the dual-CPU machine.
The two bold entries are points 91) and (2) on the chart below. The first one is interesting because it should be the same as -mx1 or -mx5 (since 7z officially only uses 1,5,7,9) but it looks as though it's a single threaded version of -mx5.
The extra ones labelled 9a,9b,9d had command lines contributed by someone in the forums are as follows:
7z a -mx9 -mmt -m0=bcj2 -m1=lzma:d27 -m2=lzma:d20:mf=bt2 -m3=lzma:d20:mf=bt2 -mb0:1 -mb0s1:2 -mb0s2:3 7z a -mx9 -mmt -m0=bcj2 -m1=lzma:d27 -m2=lzma:d20:mf=bt2 -m3=lzma:d20:mf=bt2 -mb0:1 -mb0s1:2 -mb0s2:3 7z a -mx9 -mmt -m0=bcj2 -m1=lzma:d27:fb32:a1 -m2=lzma:d20:mf=bt2 -m3=lzma:d20:mf=bt2 -mb0:1 -mb0s1:2 -mb0s2:3
The steep drop in size and compression time increases is in the first series of variations - as the compression setting changes from - mx1 to -mx9 in several steps the time taken increases and resulting size drops.
Once I start playing with the compression mode and fast bytes things don't change very much, and worse, they do so fairly unpredictably. So you would probably need to produce several files and choose the smallest. Note that mode 2/32 bytes gives similar compression to 2/64 but is noticeably faster, and that 255 fast bytes gives a bigger file than 128 but takes 50% longer (5 hours!).
I used 7Zip 4.26 beta, WinRK v1.04.1 (alpha), gzip 1.3.5, bzip2 1.0.2.
Comments? Email moz at the geek domain.