fix(allocator-bench): change cargo run to cargo build for performance measurement

This commit is contained in:
monosans
2026-02-02 16:39:48 +03:00
parent ad6c52f1fe
commit 0f31744103
3 changed files with 28 additions and 4 deletions
+7 -2
View File
@@ -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
+8 -1
View File
@@ -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)"
+13 -1
View File
@@ -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"
}