I recently had to evaluate the preformance of the Rarsofts new beta of WinRAR.
WinRAR is a powerful GUI and CLI archiever that handles many archieve formats.
In order to test the preformance I installed WinRAR 3.80 as well as WinRAR 3.90beta1 (in both 32 and 64-bit versions).
Here is a light version of the PowerShell script I came up with (please adjust file paths and $source according to your own need):
Function Test-Rar { param ($winrar = "c:\Program Files (x86)\WinRAR\Rar.exe", $source = "d:\psref351.pdf", $target = "c:\test.rar", $testruns = 1) $version = & $winrar Write-Host "Test using: $winrar" -fore "green" Write-Host $version[1] -fore "green" for ($i = 1; $i -le $testruns; $i++){ if (Test-Path $target) { del $target } $time = Measure-Command {& $winrar a $target $source} $sourcesize = (Get-ChildItem $source).length $targetsize = (Get-ChildItem $target).length $obj = New-Object Object $obj | Add-Member Noteproperty Testrun -value $i $obj | Add-Member Noteproperty TimeInSeconds -value ([math]::round(($time.totalseconds), 2)) $obj | Add-Member Noteproperty SourceByteSize -value $sourcesize $obj | Add-Member Noteproperty TargetByteSize -value $targetsize $obj | Add-Member Noteproperty CompressionPercent -value ([math]::round( (1-($targetsize / $sourcesize)) * 100,2)) $obj }}The above function can be use in the following way:
Test-Rar -source "d:\psref351.pdf" -target "d:\test.rar"However, I needed to run tests with several versions of WinRAR and compress rather large files. So I needed a small function to repeat the same test multipel times with different versions of WinRAR.
Function MultiTest { Param ($rarversions = "c:\Program Files (x86)\WinRAR\Rar.exe") foreach ($rarversion in $rarversions) { $result = Test-RAR -testruns 5 -winrar $rarversion $result $stat = $result | Measure-Object -Property TimeInSeconds -min -max -average $stat | Add-Member Noteproperty Executable -value $rarversion $stat }}Here is how to use the function:
$rarversions = "c:\Program Files (x86)\WinRAR\Rar.exe", "D:\wrar39b1\rar.exe", "D:\winrar-x64-39b1\rar.exe" $result = MultiTest $rarversions $result | Select Executable, Count, Average, Maximum, Minimum | ft -auWhile this is not a preview of the new WinRAR version, my results indicate a decrease in the time required to create a .rar file in the 20-30% range. Most impressive indeed!