Commit c17af17
Guard measure.sh against reporting numbers that mean nothing
Review points on #53, plus ideas borrowed from rubyatscale/codeowners-rs#121,
which builds the same kind of harness and systematizes the failure modes.
The theme is that a measurement tool's worst failure is a plausible number, not
an error. Four guards:
- Refuse to time a binary that does not work. `hyperfine --ignore-failure` is
needed because `pks check` exits 1 on violations, but it also treats a panic
(101) or an internal error (2) as a valid run -- so a change that broke the tool
outright would report a fast, clean-looking mean. Now probes once first, accepts
only 0 or 1, and greps for `panicked at`. Verified against
tests/fixtures/app_with_monkey_patches, which panics: refused, panic printed.
- Warn loudly under 1000 files. The phases this exists to compare scale with
codebase size; on a fixture they are all startup cost. My own smoke test printed
"19.3 ms +/- 3.0 ms" for a 9-file fixture, which looks like a measurement and is
not one.
- Report the noise floor next to the mean, so a delta can be judged against it
rather than assumed real. Also states that this is *within-batch* spread and
understates between-session drift -- an unchanged binary measured 5.1s and 8.1s
on the same machine hours apart, which is larger than most effects worth
hunting. The guidance is to A/B two builds in one hyperfine run.
- Record provenance: corpus file count, pack count, commit, and whether the corpus
is dirty, plus the pks commit and branch. A mean without the corpus it came from
is not comparable to anything, and mixing two was previously silent.
Also adds the `command -v hyperfine` check to run_benchmarks.sh, which measure.sh
already had.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 7696a5f commit c17af17
2 files changed
Lines changed: 77 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
67 | 120 | | |
68 | 121 | | |
69 | 122 | | |
| |||
85 | 138 | | |
86 | 139 | | |
87 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
88 | 160 | | |
89 | 161 | | |
90 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
18 | 23 | | |
19 | 24 | | |
20 | 25 | | |
| |||
0 commit comments