Skip to content

Commit 5f1cdd3

Browse files
committed
fix: update allocator benchmark to track page faults accurately
1 parent d08952c commit 5f1cdd3

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

.github/scripts/allocator_bench_windows.ps1

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,19 @@ function Run-One([string]$allocator, [string]$features) {
2727

2828
$exe = "target\\release\\proxy-scraper-checker.exe"
2929
$peak = 0
30+
$faults = 0
3031
$proc = Start-Process -FilePath $exe -PassThru -NoNewWindow
3132
while (-not $proc.HasExited) {
3233
Start-Sleep -Milliseconds 200
3334
try {
3435
$p = Get-Process -Id $proc.Id -ErrorAction Stop
3536
$current = [math]::Max($p.WorkingSet64, $p.PeakWorkingSet64)
3637
if ($current -gt $peak) { $peak = $current }
38+
if ($p.PageFaults -gt $faults) { $faults = $p.PageFaults }
3739
} catch { }
3840
}
3941
$peakKb = [math]::Floor($peak / 1kb)
40-
Add-Content -Path results.tsv -Value "$allocator`t$peakKb`t0`t0"
42+
Add-Content -Path results.tsv -Value "$allocator`t$peakKb`t$faults"
4143
}
4244

4345
if (Test-Path results.tsv) { Remove-Item results.tsv -Force }
@@ -51,21 +53,20 @@ $rows = Get-Content results.tsv | ForEach-Object {
5153
[pscustomobject]@{
5254
Allocator = $parts[0]
5355
PeakKB = [int]$parts[1]
54-
MajorPF = [int]$parts[2]
55-
MinorPF = [int]$parts[3]
56+
PageFaults = [int]$parts[2]
5657
}
5758
}
58-
$sorted = $rows | Sort-Object PeakKB, MajorPF, MinorPF
59+
$sorted = $rows | Sort-Object PeakKB, PageFaults
5960
$best = $sorted | Select-Object -First 1
6061

6162
$summary = @()
6263
$summary += "### $($env:PLATFORM_LABEL) (tokio-multi-thread=$tokioOn)"
6364
$summary += ""
64-
$summary += "| Allocator | Peak KB | Major PF | Minor PF |"
65-
$summary += "| --- | ---: | ---: | ---: |"
65+
$summary += "| Allocator | Peak KB | Page Faults |"
66+
$summary += "| --- | ---: | ---: |"
6667
foreach ($row in $sorted) {
67-
$summary += "| $($row.Allocator) | $($row.PeakKB) | $($row.MajorPF) | $($row.MinorPF) |"
68+
$summary += "| $($row.Allocator) | $($row.PeakKB) | $($row.PageFaults) |"
6869
}
6970
$summary += ""
70-
$summary += "**Best:** $($best.Allocator) ($($best.PeakKB) KB, $($best.MajorPF) major PF, $($best.MinorPF) minor PF)"
71+
$summary += "**Best:** $($best.Allocator) ($($best.PeakKB) KB, $($best.PageFaults) page faults)"
7172
$summary -join "`n" | Add-Content $env:GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)