Skip to content

Instantly share code, notes, and snippets.

@jsmcnair
Last active July 31, 2019 11:32
Show Gist options
  • Save jsmcnair/3287f24f69cb6904c1446f4d007ec345 to your computer and use it in GitHub Desktop.
Save jsmcnair/3287f24f69cb6904c1446f4d007ec345 to your computer and use it in GitHub Desktop.
Downloads and unzips OctaneBench, then runs 3 benchmarks and returns the average score
function Get-OctaneBenchScore {
$source = "https://render.otoy.com/downloads/a/787/7e324f5a-3598-41b2-9b07-3fbf678163af/OctaneBench_4_00c_win.zip"
$out = "C:\OctaneBench4.zip"
$obfolder = "C:\octanebench\"
$obpath = Join-Path $obfolder "OctaneBench_4_00c_win\octane-cli.exe"
$log = Join-Path $obfolder "log.txt"
if(-not (Test-Path $obpath)) {
# Download
Invoke-WebRequest -Uri $source -OutFile $out
# Unpack
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($out, $obfolder)
}
# Run OctaneBench
Start-Process -FilePath $obpath -ArgumentList "-a $log" -Wait
# Return score
([regex]"Total score:.*`n(\d*`.{1}\d*)").Matches((Get-Content $log -raw)).groups[1].Value
}
# Run once
# Get-OctaneBenchScore
# Average of 3
1..3 | Foreach-Object { Get-OctaneBenchScore } | Measure-Object -Average
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment