benchmarking
暂无简介
- License 许可
- MIT
- 所属仓库
- poppyTM/oride
- 最近更新
- 2026-09-30
- Stars
- ★ 1
- Forks
- 0
02 资源文件 6
- 参考文档checks/benchmarking-checklist.md2.3 KB
- 参考文档manifest.json2.3 KB
- 参考文档references/benchmarking-guide.md3.7 KB
- 脚本scripts/verify.sh3.8 KB
- 参考文档templates/benchmarking-spec.md2.5 KB
- 参考文档templates/benchmarking-template.md802 B
03 SKILL.md 正文
Statistical Performance Benchmarking & Regression Detection
Purpose
Design and execute deterministic, statistically sound performance benchmarks (Go benchmarks, pytest-benchmark, k6, hyperfine) with warmup discipline, percentile reporting, and confidence-gated regression detection, so performance claims are evidence, not anecdotes.
Use when
- Proving a change is faster: before/after benchmarks with confidence intervals for an optimization Goal.
- Setting or enforcing performance budgets: p99 latency ceilings, throughput floors, startup time caps.
- Detecting regressions in CI: benchmark tracking over commits with statistical gating, not single-run comparisons.
- Choosing between implementations: A/B measurement of algorithms, serializers, or query shapes under identical load.
Do not use when
- Auditing code complexity or duplication without timing anything (use
code-quality). - Debugging a functional bug where performance is irrelevant (fix it; do not benchmark it).
- Designing cache topologies to avoid load rather than measure it (use
caching). - Running one-off timing with
timeand eyeballing the result (that is not a benchmark; this skill forbids it).
Required context
- Benchmark harness and versions: Go 1.24.3
testingbenchmarks, pytest-benchmark 4.1.1, k6 0.57.2, hyperfine 1.18.0. - Target metric and budget: e.g. invoice rendering p99 at most 120 ms at 500 rps, or JSON marshal at least 180 MB/s.
- Load profile: concurrency, dataset size, warmup iterations, and production traffic shape being simulated.
- Execution environment: pinned machine or runner class, CPU governor, isolation from noisy neighbors.
Procedure
- Fix the environment and harness:
- Pin benchmarks to one runner class (
c6i.xlargededicated, or thebenchGitHub runner label); record CPU model, core count, and governor (performance). - Disable frequency scaling variance: run
cpupower frequency-set -g performanceon bare metal, or document that cloud runs carry ±5 percent noise. - Choose the harness per layer:
go test -benchfor functions,pytest-benchmarkfor Python paths,k6for HTTP endpoints,hyperfinefor CLI startup.
- Pin benchmarks to one runner class (
- Design the measurement with warmup and repetitions:
- Discard warmup explicitly:
-benchtime=5s -count=6in Go (drop run 1),--warmup=on --warmup-iterations=3in pytest-benchmark, k6stageswith a 60-second ramp before the 5-minute steady window. - Size datasets to production shape: 50,000 invoices with the real size distribution (median 2.1 KB, p99 48 KB), not 10 synthetic rows.
- Run at least 5 measured repetitions; record min, median, p90, p99, and max for every series.
- Discard warmup explicitly:
- Analyze with statistics, not vibes:
- Compare before/after with relative change plus a 95 percent confidence interval; use
benchstat old.txt new.txtfor Go series. - Declare improvement only when the full confidence interval clears the noise floor: e.g.
delta -8.4% ±1.9%is a win,delta -1.2% ±2.6%is noise. - For k6 runs, gate on
p(99)<120thresholds in the script itself (thresholds: { http_req_duration: ['p(99)<120'] }) so CI fails on breach.
- Compare before/after with relative change plus a 95 percent confidence interval; use
- Guard against benchmark lies:
- Verify the compiler did not eliminate the work: consume results via
benchmark.ReportMetric,black_box, or writing checksums; check assembly or instruction counts when a result looks impossibly fast. - Run the A/A control: benchmark the same code twice and confirm the delta interval includes zero before trusting any A/B delta.
- Isolate from neighbors: no parallel CI jobs on the bench runner during measurement; record load average alongside results.
- Verify the compiler did not eliminate the work: consume results via
- Record and gate:
- Store results in
templates/benchmarking-spec.mdwith environment, harness flags, raw numbers, and the benchstat verdict. - Wire the budget into CI (
k6thresholds,benchstatdelta gates) so the next regression fails the build, not a human review. - Run the verification script
scripts/verify.shfrom the repo root; it must exit 0.
- Store results in
Decision rules
- No Single-Run Claims: Any latency or throughput claim from fewer than 5 measured repetitions is rejected as evidence.
- Warmup Is Mandatory: Benchmarks without explicit warmup and discarded first runs are invalid; cold-start numbers measure page faults, not code.
- Confidence Interval Decides: A change ships as faster only when the 95 percent interval excludes zero in the favorable direction.
- A/A Control Before A/B Verdict: If the same-code control shows nonzero drift beyond the noise floor, fix the environment before judging the change.
- Budgets Are Gates, Not Aspirations: A breached p99 budget fails CI exactly like a failed test; waivers need owner and expiry.
Evidence required
- Benchmark specification adhering to
templates/benchmarking-spec.mdwith environment, flags, and raw series. - Raw repetition logs: at least 5 measured runs per variant plus the discarded warmup runs.
benchstat(or equivalent) comparison output with deltas and confidence intervals.- A/A control run proving the environment is stable before the A/B verdict.
- Passing execution log from
scripts/verify.sh.
Output contract
- Measured verdict per comparison: delta percent, 95 percent confidence interval, and ship/no-ship recommendation.
- CI gate configuration enforcing the budget on every protected-branch run.
- Environment record: runner class, CPU, governor, dataset shape, harness flags.
- Regression report when applicable: offending commit range, metric drift, and bisect notes.
Stop conditions
- All claimed improvements backed by confidence intervals excluding zero, with A/A control green.
- Performance budgets wired into CI thresholds and passing on the protected branch.
- Regression root-caused to a commit range or formally accepted with owner and revisit date.
- Token budget exhausted.
- Blocked on external dependency.
Escalation rules
- Escalate to the owning team if the A/A control never stabilizes (noisy shared runners, thermal throttling) and dedicated bench hardware is needed.
- Escalate to Lead Architect if meeting the budget requires an architecture change (new index, protocol change, caching layer) beyond the Goal scope.
- Escalate immediately if benchmarking exposes a correctness bug under load (data races, dropped writes); stop measuring and file the defect.
04 同仓库更多 Skills
zoom-reflow
暂无简介
wireframe-styleguide
暂无简介
visual-regression
Pixel-by-pixel snapshot testing, Playwright integration, dynamic content masking, deterministic font rendering, and cross-browser CI gates
ui-implementation
Component-driven UI implementation, multi-state matrix (default, hover, focus-visible, active, disabled, loading, empty, error), DTCG design tokens, responsive layout contracts, and accessibility tree mapping.
tui-editor-engine
Text buffer and editing semantics for a terminal code editor — index conversion, transaction-first editing, multi-cursor invariants, undo grouping, and large-file behaviour.
tree-sitter-context-indexing
暂无简介