Skip to content

Commit 293e9db

Browse files
committed
Scale extrapolation targets to input size
1 parent 8827252 commit 293e9db

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

scripts/bench_heap_profile.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,17 @@ echo "$PEAK_PAIRS" | awk '{
232232
for (i=0;i<n;i++) { p=a+b*x[i]; ss_res+=(y[i]-p)^2; ss_tot+=(y[i]-ym)^2 }
233233
r2 = (ss_tot>0) ? 1 - ss_res/ss_tot : 1
234234
printf " Model: peak = %.0f + %.0f * steps_M (R²=%.4f)\n\n", a, b, r2
235-
targets[0]=8; targets[1]=16; targets[2]=32; targets[3]=64
236-
labels[0]="8M"; labels[1]="16M"; labels[2]="32M"; labels[3]="64M"
235+
xmax = 0
236+
for (i=0;i<n;i++) if (x[i] > xmax) xmax = x[i]
237+
mults[0]=2; mults[1]=4; mults[2]=8; mults[3]=16
237238
for (t=0; t<4; t++) {
238-
pred = a + b * targets[t]
239-
printf " fib_iterative_%-6s ~%.0f MB (~%.0f GB)\n", labels[t], pred, pred/1024
239+
target_m = mults[t] * xmax
240+
pred = a + b * target_m
241+
abs = target_m * 1000000
242+
if (abs >= 1000000) lbl = sprintf("%gM", abs / 1000000)
243+
else if (abs >= 1000) lbl = sprintf("%gk", abs / 1000)
244+
else lbl = sprintf("%g", abs)
245+
printf " fib_iterative_%-6s ~%.0f MB (~%.0f GB)\n", lbl, pred, pred/1024
240246
}
241247
}'
242248

0 commit comments

Comments
 (0)