golang-benchmark

Design and execute Go benchmarks with b.Loop and benchstat comparisons.

2.9k|191|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/samber/cc-skills-golang --skill golang-benchmark
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-benchmark
Source: https://github.com/samber/cc-skills-golang/tree/main/skills/golang-benchmark
Command: npx skills add https://github.com/samber/cc-skills-golang --skill golang-benchmark

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go performance analysis often suffers from biased or inconsistent measurement. This skill provides a rigorous framework to design, run, and interpret benchmarks to quantify performance changes accurately.

Core Features & Use Cases

  • Benchmark design & execution: design benchmarks that minimize setup noise and use b.Loop (Go 1.24+) to ensure reliable timing.
  • Profiling & analysis: integrate CPU, memory, and trace profiling (pprof, benchstat) to understand performance characteristics and bottlenecks.
  • CI regression & trend tracking: compare runs across commits with benchstat/benchdiff to guard against regressions.
  • Cross-skill integration: ties into golang-performance and golang-troubleshooting for end-to-end optimization.

Quick Start

Run a baseline benchmark, capture results, and compare against the target version using benchstat/benchdiff for statistical validation.

Frequently Asked Questions about golang-benchmark

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent flaky results when running golang benchmarks?

You can design golang benchmarks that minimize setup noise by using the b.Loop pattern introduced in Go 1.24+ to ensure reliable timing and eliminate measurement bias during execution.

What is the best way to detect performance regressions in Go CI pipelines?

Detecting performance regressions in CI pipelines requires capturing baseline benchmark runs and comparing them against target versions using benchstat to validate performance changes statistically before deployment.

How do I use pprof and benchstat for Go CPU and memory profiling?

Go CPU and memory profiling integrates pprof and benchstat directly into benchmark workflows to identify performance bottlenecks and quantify resource consumption characteristics across code changes.

Does this benchmarking approach support Go 1.24 b.Loop patterns?

Yes, this benchmarking approach fully supports Go 1.24 b.Loop patterns to ensure reliable timing during execution, avoiding measurement biases inherent in older testing.Benchmark loop structures.

How do I compare Go benchmark results across different commits?

Comparing Go benchmark results across commits uses benchstat or benchdiff to statistically validate performance differences, track regression trends, and guard against code changes degrading production performance.