fix(allocator-bench): change cargo run to cargo build for performance measurement
This commit is contained in:
@@ -30,9 +30,14 @@ build_features() {
|
||||
for allocator in system jemalloc mimalloc_v2 mimalloc_v3; do
|
||||
features="$(build_features "$allocator")"
|
||||
if [ -n "$features" ]; then
|
||||
output="$(/usr/bin/time -v cargo run --release --locked --features "$features" 2>&1 >/dev/null)"
|
||||
cargo build --release --locked --features "$features"
|
||||
else
|
||||
output="$(/usr/bin/time -v cargo run --release --locked 2>&1 >/dev/null)"
|
||||
cargo build --release --locked
|
||||
fi
|
||||
if [ -n "$features" ]; then
|
||||
output="$(/usr/bin/time -v /work/target/release/proxy-scraper-checker 2>&1 >/dev/null)"
|
||||
else
|
||||
output="$(/usr/bin/time -v /work/target/release/proxy-scraper-checker 2>&1 >/dev/null)"
|
||||
fi
|
||||
peak="$(echo "$output" | awk -F': ' '/Maximum resident set size/ {print $2; exit}')"
|
||||
if [ -z "$peak" ]; then
|
||||
|
||||
@@ -46,8 +46,15 @@ run_one() {
|
||||
feature_args=(--features "$features")
|
||||
fi
|
||||
|
||||
cargo build --release --locked "${feature_args[@]}"
|
||||
|
||||
local exe="target/release/proxy-scraper-checker"
|
||||
if [[ "$RUNNER_OS" == "Windows" ]]; then
|
||||
exe="target/release/proxy-scraper-checker.exe"
|
||||
fi
|
||||
|
||||
local output
|
||||
output="$(${time_cmd[@]} cargo run --release --locked "${feature_args[@]}" 2>&1 >/dev/null)"
|
||||
output="$(${time_cmd[@]} "$exe" 2>&1 >/dev/null)"
|
||||
|
||||
local peak
|
||||
peak="$(echo "$output" | parse_peak)"
|
||||
|
||||
@@ -11,7 +11,7 @@ function Build-Features([string]$allocator, [string]$tokio) {
|
||||
}
|
||||
|
||||
function Run-One([string]$allocator, [string]$features) {
|
||||
$args = @("run", "--release", "--locked")
|
||||
$args = @("build", "--release", "--locked")
|
||||
if ($features) { $args += "--features"; $args += $features }
|
||||
|
||||
$peak = 0
|
||||
@@ -24,6 +24,18 @@ function Run-One([string]$allocator, [string]$features) {
|
||||
if ($current -gt $peak) { $peak = $current }
|
||||
} catch { }
|
||||
}
|
||||
|
||||
$exe = "target\\release\\proxy-scraper-checker.exe"
|
||||
$peak = 0
|
||||
$proc = Start-Process -FilePath $exe -PassThru -NoNewWindow
|
||||
while (-not $proc.HasExited) {
|
||||
Start-Sleep -Milliseconds 200
|
||||
try {
|
||||
$p = Get-Process -Id $proc.Id -ErrorAction Stop
|
||||
$current = [math]::Max($p.WorkingSet64, $p.PeakWorkingSet64)
|
||||
if ($current -gt $peak) { $peak = $current }
|
||||
} catch { }
|
||||
}
|
||||
$peakKb = [math]::Floor($peak / 1kb)
|
||||
Add-Content -Path results.tsv -Value "$allocator`t$peakKb"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user