2019-10-27

7za.exe vs 7z.exe (7-Zip 9.20 vs 19.0)


While working with a completely different task I found an old backup job using 7za.exe (from 7-zip) to compress some SQL backup files.

Syntax was like this:
7za.exe -a backup.7zip c:\backupfolder -mx1 -mmt

The "-mx1means it will compress using the fastest compression, which basically is just like "tar", it takes all the files and put them in a combined file, and "-mmt" enables multi threading to speed things up.

What made me investigate this further was the fact that the CPU & disk load on the server was very low, It was hardly noticeable at all.

I am currently building a new main computer for home, and are running some benchmarks on different combinations of RAID-levels and SSD/HDDs (will be a new blog post about this in the furure), so I took one of my test folders with mixed files created by the Intel NAS Performance Toolkit and run some compression testing.



The version of 7za.exe was from 7-Zip 9.20 that was released 2010-11-18 and the 7z.exe is from the latest stable release 19.0 from 2019-02-21.

I made short powershell script to automate the benchmark, it looks like this:

(sorry about the bad code print on the blog, If anyone know how to embedd code on blogger, please let me know!)

ForEach ($number in 1..9 ) { $MeasuredTime = Measure-Command { Start-process "D:\Downloads\7za920\7za.exe" -ArgumentList "a","c:\temp\7za-NAS_Performance_Toolkit-$($number).7z","R:\NAS_Performance_Toolkit","-mx$($number)","-mmt" -Wait } $TimeItTook = "$($MeasuredTime.Hours)h.$($MeasuredTime.Minutes)m.$($MeasuredTime.Seconds)s.$($MeasuredTime.Milliseconds)ms" Rename-Item -NewName "c:\temp\7za-NAS_Performance_Toolkit-$($number)-$($TimeItTook).7z" -Path "c:\temp\7za-NAS_Performance_Toolkit-$($number).7z" }

It will create 7 files with the time it took to create in the file name.

Then I run the same using 7z.exe and it looks almost the same:
(I didnt know how long it would take for the old version so I added hours just in case)

ForEach ($number in 1..9 ) { $MeasuredTime = Measure-Command { Start-process "D:\Downloads\7z1900-x64\7z.exe" -ArgumentList "a","c:\temp\7z-NAS_Performance_Toolkit-$($number).7z","R:\NAS_Performance_Toolkit","-mx$($number)","-mmt" -Wait } $TimeItTook = "$($MeasuredTime.Minutes)m.$($MeasuredTime.Seconds)s.$($MeasuredTime.Milliseconds)ms" Rename-Item -NewName "c:\temp\7z-NAS_Performance_Toolkit-$($number)-$($TimeItTook).7z" -Path "c:\temp\7z-NAS_Performance_Toolkit-$($number).7z" }

When I run the second tests using 7z.exe I could see that CPU usage got to 100% and the disk write speeds when up the roof. Good!

Here are the results:


As you can see the new version is about 10 times faster than the old version.
It also seems like the test files created by the Intel NASPT software is very easily compressed.

To summarize
7za.exe version 9.20 took 11 min 33 seconds (with the -mx1 setting)
7za.exe version 19.0 took 54 seconds (with the -mx1 setting)

This also applied when I tested this on some large SQL backups.
7za.exe took about 2 hours to compress the SQL files and 7z.exe took about 20 minutes to do the same on the same machine.

I also run a compression with the -mx9 flag on the SQL files and the .7z file shrink from abouit 20GB to 11 GB (but it took over 5 hours)

Can we learn anything from this?
Well, I think we should replace all usage of the older 7za.exe with the much faster 7z.exe!
We should also runs some tests on our scheduled tasks to find the sweet-spot between time (CPU usage) and file size.