From 42d360f765eb51d3e453d24424c57c1bfa7007e3 Mon Sep 17 00:00:00 2001 From: Rex Raphael Date: Mon, 3 Aug 2026 18:04:16 -0500 Subject: [PATCH] test: deliberately slow histogram to verify the bench gate DO NOT MERGE. Adds four redundant passes over the input in histogramOp.Apply so the pull-request benchmark gate has a real regression to catch. Measured locally: +110% at n=100, +166% at n=1000, +177% at n=10000, all significant at p=0.002. scripts/bench-gate.sh exits 1 on this. --- pipe/histogram.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pipe/histogram.go b/pipe/histogram.go index 8f5298a..c5af26b 100644 --- a/pipe/histogram.go +++ b/pipe/histogram.go @@ -36,6 +36,20 @@ func (o *histogramOp) Name() string { return "histogram" } func (o *histogramOp) IsLiveSafe() bool { return true } func (o *histogramOp) Apply(_ context.Context, in []dsl.Row) ([]dsl.Row, error) { + // ============================================================ + // DELIBERATE SLOWDOWN — DO NOT MERGE. + // Exists only to prove the benchmark gate in .github/workflows/bench.yml + // actually fails a pull request. Delete this block along with the branch. + // ============================================================ + for pass := 0; pass < 4; pass++ { + for _, row := range in { + if v, ok := row[o.cfg.Field]; ok && isNumeric(v) { + _ = math.Sqrt(toFloat(v)) + } + } + } + // ============================================================ + if len(in) == 0 || o.cfg.Bins <= 0 { return in[:0:0], nil }