Skip to content

test: add benchmarks, examples, and bench-regression guard (#15)#24

Merged
millerjp merged 1 commit intomainfrom
issue-15-benchmarks-examples
Apr 20, 2026
Merged

test: add benchmarks, examples, and bench-regression guard (#15)#24
millerjp merged 1 commit intomainfrom
issue-15-benchmarks-examples

Conversation

@millerjp
Copy link
Copy Markdown

Summary

Completes the Phase 4 benchmark scaffolding: a full per-method benchmark suite, overhead pairs vs raw sync.Map, runnable godoc Examples for every public symbol, the committed bench.txt baseline, and the benchstat-regression-guard CI job (mirroring mask).

Closes #15.

Highlights

  • syncmap_bench_test.go — expanded from 9 to 28 benchmarks. Covers Load (hit + miss), Store, LoadOrStore (loaded + stored), LoadAndDelete, Delete, Range, Len, Map, Keys, Values, a concurrent 90/10 read-write pattern (pre-computed key pool so allocs/op isn't dominated by the harness), and five Overhead pairs (Load/Store/LoadOrStore/Delete/LoadAndDelete each with syncmap vs raw sync.Map).
  • example_test.go — 14 runnable Example* functions, one per public symbol. Iterators (Range/Keys/Values/Map) sort output so // Output: blocks are deterministic. All pass go test -run Example.
  • bench.txt — committed baseline from darwin/arm64, -count=5. Header documents regen procedure and the CI consumer.
  • scripts/check-bench-regression.sh — ported from mask with two fixes: skip geomean summary rows and exclude zero-delta matches. The script is now stable against itself (a bench.txt → bench.txt compare reports zero regressions, which mask's original would false-positive on).
  • Makefilebench-regression target.
  • .github/workflows/ci.ymlbenchstat-regression-guard job (benchstat pinned to same version as mask, Dependabot skip, shared-runner CAVEAT preserved). makefile-targets-guard expected list updated to include bench-regression.
  • .gitignorebench-regression.txt, current.txt.

Local validation

$ make check                      # 14/14 gates green, coverage 100%
$ make bench-regression           # "No regressions above threshold."
$ go test -run Example ./...      # 14/14 pass
$ actionlint .github/workflows/*.yml  # clean

Agent gates

  • Plan — single-commit scope, six-file bundle, bench.txt committed from this machine (matches mask's M2 baseline convention).
  • performance-reviewer (post) — no BLOCKING. Applied both IMPORTANTs: concurrent bench pre-computes keys (dropping a spurious 1 alloc/op); Overhead pair comment clarifies the Store-included workload.
  • code-reviewer (post) — no BLOCKING. Six NITs, all optional or already addressed.
  • go-quality — 8/8 PASS.
  • commit-message-reviewer — PASS.

Deferrals

Test plan

  • All 13 CI jobs green, including the new benchstat-regression-guard
  • benchstat-report artefact uploaded from the guard job
  • Coverage remains 100%

Complete the Phase 4 benchmark scaffolding:

  * syncmap_bench_test.go now has 28 benchmarks: one per public
    method (with hit/miss / loaded/stored variants where meaningful),
    a concurrent 90/10 read-write pattern, and five Overhead pairs
    comparing the generic wrapper against raw sync.Map.
  * example_test.go adds runnable godoc Example functions for all
    12 public symbols plus the two top-level CompareAnd* funcs.
    Range/Keys/Values/Map sort their output so // Output: blocks
    stay deterministic.
  * bench.txt seeds the committed baseline (darwin/arm64, count=5).
  * scripts/check-bench-regression.sh parses benchstat output and
    fails on time/op regressions >= 10% at p <= 0.05 or any positive
    allocs/op delta. Ported from axonops/mask with two fixes: skip
    geomean summary rows and exclude zero-delta matches so the guard
    is stable against itself.
  * Makefile: bench-regression target; ci.yml: benchstat-regression-
    guard job (mirrors mask, Dependabot skip, CAVEAT preserved);
    makefile-targets-guard expected list updated.

Coverage remains 100%. CONTRIBUTING §Performance baseline referenced
by the CI job is deferred to #18.
@millerjp millerjp merged commit f225221 into main Apr 20, 2026
14 checks passed
@millerjp millerjp deleted the issue-15-benchmarks-examples branch April 20, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add benchmarks, runnable examples, and bench-regression infrastructure

1 participant