omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / tools / argus / r8_stats.sh
| 1 | #!/bin/bash |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # Paired statistics for r8_wall_ab.sh output: per config mean/sd; for each config vs BASE the |
| 18 | # mean of per-round differences as % of BASE's mean, with a t-based 95% CI (t from df). |
| 19 | # Usage: r8_stats.sh out.jsonl BASE |
| 20 | jq -r '[.cfg, .round, .wall_us, .passed] | @tsv' "$1" | awk -v base="$2" -F'\t' ' |
| 21 | function tq(df) { return df >= 120 ? 1.980 : df >= 60 ? 2.000 : df >= 40 ? 2.021 : df >= 30 ? 2.042 : df >= 20 ? 2.086 : 2.262 } |
| 22 | { w[$1, $2] = $3; c[$1] = 1; if ($2 > R) R = $2; if ($4 != "true") bad[$1]++ } |
| 23 | END { |
| 24 | for (k in c) { s = 0; ss = 0; m = 0; for (r = 1; r <= R; r++) if ((k, r) in w) { s += w[k, r]; ss += w[k, r]^2; m++ } |
| 25 | mean[k] = s / m; sd[k] = sqrt((ss - s * s / m) / (m - 1)); cnt[k] = m } |
| 26 | printf "%-12s %6s %10s %8s %9s %22s %8s\n", "cfg", "n", "mean_ms", "sd_ms", "vs_base", "95% CI (paired)", "halfw" |
| 27 | for (k in c) { |
| 28 | if (k == base) { printf "%-12s %6d %10.3f %8.3f %9s %22s %8s\n", k, cnt[k], mean[k]/1000, sd[k]/1000, "-", "-", "-"; continue } |
| 29 | s = 0; ss = 0; m = 0 |
| 30 | for (r = 1; r <= R; r++) if (((k, r) in w) && ((base, r) in w)) { d = w[k, r] - w[base, r]; s += d; ss += d * d; m++ } |
| 31 | md = s / m; sdd = sqrt((ss - s * s / m) / (m - 1)); hw = tq(m - 1) * sdd / sqrt(m) |
| 32 | printf "%-12s %6d %10.3f %8.3f %+8.2f%% [%+6.2f%%, %+6.2f%%] %7.2f%%%s\n", k, cnt[k], mean[k]/1000, sd[k]/1000, |
| 33 | 100 * md / mean[base], 100 * (md - hw) / mean[base], 100 * (md + hw) / mean[base], 100 * hw / mean[base], |
| 34 | (bad[k] ? " FAILED RUNS " bad[k] : "") |
| 35 | } }' | sort -k1,1 |