benchmark-analyzer

Execute Go benchmarks and analyze ns/op metrics to identify bottlenecks.

Updated Oct 23, 2025
One-click install
npx skills add https://github.com/kis9a/claude-skills-demo --skill benchmark-analyzer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: benchmark-analyzer
Source: https://github.com/kis9a/claude-skills-demo/tree/main/.claude/skills/benchmark-analyzer
Command: npx skills add https://github.com/kis9a/claude-skills-demo --skill benchmark-analyzer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go benchmarks are often missing or poorly representative; this Skill runs benchmarks, analyzes ns/op, B/op, and allocs/op, identifies bottlenecks, and proposes practical optimizations.

Core Features & Use Cases

  • Benchmark discovery: detects existing Benchmark functions in tests
  • Automated run: executes go test -bench=. -benchmem -benchtime=3s
  • Results analysis: interprets ns/op, B/op, allocs/op and identifies hot paths
  • Optimization guidance: provides concrete, trade-off aware improvement suggestions
  • Report: outputs a Markdown analysis with results and recommendations

Quick Start

Run benchmark-analyzer on your package to generate a report and suggested optimizations; review and apply changes as appropriate.

Frequently Asked Questions about benchmark-analyzer

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

FAQPage Schema
How do I identify performance bottlenecks in my Go code?

Performance bottlenecks in Go are identified by running benchmarks and analyzing execution metrics—ns/op (nanoseconds per operation), B/op (bytes allocated), and allocs/op (allocation count). benchmark-analyzer automates this: it discovers or generates benchmarks, executes them with consistent parameters, and reports which functions consume the most time or memory, pinpointing optimization targets.

What's the best way to optimize Go benchmarks for production performance?

Optimize Go benchmarks by first measuring what matters: run benchmarks multiple times to find stable results, then analyze memory allocations and CPU cycles. benchmark-analyzer executes go test -bench with memory profiling, captures reliable metrics across iterations, and suggests concrete trade-off-aware improvements based on the actual hot paths it discovers.

Can I run Go benchmarks without writing them manually?

Yes. benchmark-analyzer generates missing benchmarks when they don't exist, targeting the functions most likely to benefit from optimization. It detects existing Benchmark functions in your test files, runs them with standardized parameters (go test -bench=. -benchmem -benchtime=3s), and reports results without requiring hand-written benchmark code.

How does memory profiling help optimize Go code?

Memory profiling in Go reveals allocation patterns—how many bytes and allocations occur per operation. benchmark-analyzer performs CPU and memory profiling on your benchmarks, collecting B/op and allocs/op metrics to identify functions wasting heap space or triggering garbage collection, enabling targeted optimization recommendations.

What metrics should I focus on when analyzing Go benchmark results?

Three core metrics matter: ns/op (operation duration), B/op (bytes per operation), and allocs/op (heap allocations per operation). benchmark-analyzer interprets all three, identifies which metric dominates your bottleneck, and provides prioritized optimization guidance—whether the issue is latency, memory throughput, or garbage collection pressure.

Do I need existing benchmarks to use a Go performance analyzer?

No. benchmark-analyzer works with or without existing benchmarks. It scans your Go project for Benchmark functions, generates missing ones as needed, runs them with consistent parameters, and outputs a markdown report with optimization recommendations—whether your codebase has benchmarks already or needs them created.