Commit 3109178
committed
fix(bench): make the gate loud on dropped data and the Makefile its single source
Review fixes for the bench-gate PR:
- Silence the sync engine's global logger inside the sync benchmarks:
interleaved log.Printf output corrupted the 'BenchmarkX' result
lines, so benchfmt parsed zero sync results and all three sync
benchmarks silently dropped out of the gate on both sides.
- benchgate now treats unparseable result lines as a corrupted
capture (report + exit 2) instead of skipping benchfmt syntax
errors, and reports a gated unit missing from one side ('missing
from baseline/candidate, not gated') instead of a bare continue.
Custom ReportMetric units are reported as ungated.
- Split the sample-count policy: too few candidate samples stays a
config error, but a short baseline (a legitimately partial base
run) is reported and not gated.
- Print detected regressions even when a config issue forces exit 2,
so a real violation is never hidden behind a configuration error.
- bench.yml now runs 'make bench-gate' on both sides; the Makefile's
BENCH_GATE_PACKAGES/COUNT/TIME are the single source of truth, and
each side benchmarks its own commit's package list, so growing the
gate cannot empty the baseline. A failing base run degrades to its
partial output plus a workflow warning instead of truncating the
whole baseline into a vacuous pass. Run steps use set -euo
pipefail and the workflow gains a Go-paths filter.
- Absorb the leading-edge O(history) signal recompute before the
timer in BenchmarkSyncPathsIncrementalAppend (it was ~58% of the
measured allocs, masking steady-state regressions), stretch the
debounce window so the flush timer cannot fire nondeterministically
inside a worst-run-gated loop, and pre-build appended lines.
- Build BenchmarkInsertMessagesBatch's 200-message fixture once
outside the timed loop; only the SessionID is rewritten per
iteration.
- Widen testDB to testing.TB, drop the bench-only openBenchDB copy,
and fix BenchmarkGetDailyUsage's detached testing.T hack (its
require failures and cleanups were wired to nothing).
- Split benchgate's compare()/main() into evalGate/compareUnits/
render/parseFlags to meet function-size and complexity limits, and
drop the dead NaN guard.
- Document the new mechanics in docs/internal/performance-gates.md
and reformat it with mdformat --wrap 80.1 parent 6e01b26 commit 3109178
9 files changed
Lines changed: 604 additions & 263 deletions
File tree
- .github/workflows
- cmd/benchgate
- docs/internal
- internal
- db
- sync
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
27 | 41 | | |
28 | 42 | | |
29 | 43 | | |
| |||
32 | 46 | | |
33 | 47 | | |
34 | 48 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | 63 | | |
66 | | - | |
67 | | - | |
68 | 64 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 65 | + | |
| 66 | + | |
73 | 67 | | |
74 | 68 | | |
75 | 69 | | |
76 | | - | |
77 | 70 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
84 | 77 | | |
| 78 | + | |
85 | 79 | | |
86 | 80 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 81 | + | |
| 82 | + | |
94 | 83 | | |
95 | 84 | | |
96 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
271 | 270 | | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
276 | 277 | | |
277 | | - | |
| 278 | + | |
278 | 279 | | |
279 | 280 | | |
280 | 281 | | |
| |||
284 | 285 | | |
285 | 286 | | |
286 | 287 | | |
287 | | - | |
| 288 | + | |
288 | 289 | | |
289 | 290 | | |
290 | 291 | | |
| |||
0 commit comments