Scott Hanselmann declared 7z to be a much better format than zip and zip to be dying.
Or at least, this is how I understand his writing:
The 7z format is fast becoming the compression format that choosey hardcore users choose.
Though I’ve got a lot of respect for Scott, I have to add some facts.
Zip is Much Faster Than 7z
In my humble opinion, Scott has overseen that zip is much faster than 7z… I’ve done tests with both formats and with both formats I’ve used compression methods 1 and 5. Some of the results are staggering.
Discussion of the Results
In the compressFull tests, a data set is compressed and added to a new archive. As you can see above, compressing with zip-1 is around 4 times faster than compressing with 7z-1 and seven times faster than compressing with 7z-5. The resulting archive is only 6% bigger than the 7z-1 archive and 40% bigger than the 7z-5 archive. In my opinion, the much greater speed speaks clearly for zip.
In the extractFull tests, all the files in the archive created by fullCompress are extracted locally. Here, the speeds are not too different, e.g. extracting from a zip-1 is only around 30% faster than from a 7z-5 archive. As the 7z archives are smaller, I rate this as a draw.
In the extractSome tests, only a small number of all the files are extracted from the archive. Extracting from a zip-1 archive is 50% faster than from a 7z-1 archive and an astonishing twenty times faster than from a 7z-5 archive. As this is unbelievable, I have repeated the tests a lot of times. But it stays true. Victory by knockout for zip.
- I’ve done the tests on my oldish Fujitsu Siemens Lifebook S with a Dual Core Processor, running Win 7.
- For both archive formats I’ve used the commandline version of 7-zip 9.20, controlled by tclkitsh.exe and the tcl script given below. It is the current and stable release of 7-zip. Unchanged since 2010.
- The compression method 5 is in 7-zip the default value for both formats. Compression method 1 is the fastest compression method for both formats.
- I’ve repeated each test several times. The standard deviation of the results have mostly been very small.
- My data set has been a set of 2800 files with 192 MB uncompressed.
- The files which are extracted in the extractSome test are 72 files with 68 kB uncompressed.
Reproduction of the Tests
You can reproduce the tests easily:
- Download my script zip-test.zip and tclkitsh.zip and extract both into the same directory.
- Open the file zip-test.tcl with a text editor and adapt the first three lines. In the first line, adapt the path to the 7z.exe file on your PC. In the second line, adapt the path to the directory you want to compress.
- Open a command window, cd to the directory where you’ve put zip-test.tcl and type in
- Wait and don’t use the computer until the tests are finished.
- The results will be written on screen and at the same time appended to the file zip-test-results.txt.
- You should discard the first test, because for the first one, the speed is highly determined by the time you need to read data from the hard drive. In later runs, much of the data is in the OS’s drive buffer. So the first test is not comparable to the following ones. It does not measure compression speed, but hard drive speed. You’ll see that the first run (with zip-1) takes much longer than the following ones, even those with zip-5 or 7z-5.
- All operations on zip archives are much faster or as fast as the same operation on 7z archives.
- 7z archives are somewhat smaller than zip archives – but not much.
- My recommendation is:
Use zip as archive type. If you are using the software 7-zip, do not use the default settings. Always use compressing method 1.
What is your opinion? I’d love to hear from you.
Pingback: Tclkit: A Tiny Full Featured Scripting Language | 99 Developer Tools