Go Performance Analysis

VerifiedSafe

Runs Go benchmarks with memory stats to identify optimization opportunities. Parses results like ns/op, B/op, allocs/op to find hot spots. Helps developers reduce allocations, improve throughput, and compare performance changes.

Sby Skills Guide Bot
TestingIntermediate
6/2/2026
Claude Code
#go#benchmarking#performance#memory#optimization

Recommended for

Automated summary

Runs Go benchmarks, analyzes results including allocations and timing, and identifies optimization opportunities.

Strengths

  • Automatically discovers benchmark functions in Go test files.
  • Executes benchmarks with memory allocation statistics for comprehensive analysis.
  • Identifies specific hot spots and suggests actionable optimizations.
  • Optionally compares results with previous runs using benchstat.

Limitations

  • Requires existing benchmark functions in the codebase.
  • Relies on `-benchmem` which may not capture all allocation sources.
  • Does not perform CPU profiling; focuses on benchmark output only.
When to use it

When you need to quickly identify performance bottlenecks and memory allocation issues in Go code with existing benchmarks.

When not to use it

When you need detailed CPU profiling, flame graphs, or when working with non-Go languages.

Security analysis

Safe
Quality score90/100

The skill runs standard Go benchmarking commands (go test -bench) and analyzes results. It does not execute external or obfuscated payloads, and does not instruct to disable safety or destructively modify the system. Using Bash is necessary for running Go tools, which is a legitimate development activity.

No concerns found

How this analysis is made

Examples

Run benchmarks and analyze performance
Run all Go benchmarks in this project with memory statistics and identify the most significant optimization opportunities.
Compare current results with a baseline
Run benchmarks and compare the results with the saved baseline file 'old.txt' to detect performance regressions.
Find missing benchmarks
Check if this Go project has benchmarks. If not, suggest which functions should be benchmarked based on complexity and usage frequency.

name: go-bench description: Run Go benchmarks, analyze allocations and performance, identify optimization targets user-invocable: true allowed-tools: Read, Grep, Glob, Bash

You are a Go performance analyst. Run benchmarks, interpret results, and identify real optimization opportunities.

Steps

  1. Find benchmarks: Use Glob to find *_test.go files. Use Grep to find func Benchmark functions.

  2. Run benchmarks: Execute go test -bench=. -benchmem -count=3 ./... to get stable results with memory stats.

  3. Parse results: For each benchmark, note:

    • ns/op (time per operation)
    • B/op (bytes allocated per operation)
    • allocs/op (allocations per operation)
  4. Identify hot spots: Read the benchmarked functions. Look for:

    • Unnecessary allocations (string concatenation, slice growth, interface boxing)
    • Repeated work that could be cached
    • Synchronization overhead (mutex contention, channel bottlenecks)
    • I/O in hot paths
  5. Compare if possible: If the user provides a baseline or if previous results exist, compare using benchstat if available: go run golang.org/x/perf/cmd/benchstat@latest old.txt new.txt

  6. Output the analysis:

## Benchmark Analysis

### Results
| Benchmark | ns/op | B/op | allocs/op |
|-----------|-------|------|-----------|
| Name      | X     | Y    | Z         |

### Hot Spots
[Functions with high allocations or time, with file:line references]

### Optimization Opportunities
[Specific changes that would reduce allocations or improve throughput, ordered by expected impact]

### Recommendations
[What to benchmark next, what to profile with pprof, or what to leave alone]

If no benchmarks exist, suggest which functions should be benchmarked based on their complexity and call frequency.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/go-performance-analysis-mm8o51ms/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/go-performance-analysis-mm8o51ms' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/go-performance-analysis-mm8o51ms/download' --output '.skill-downloads/go-performance-analysis-mm8o51ms/SKILL.md.part' && mv '.skill-downloads/go-performance-analysis-mm8o51ms/SKILL.md.part' '.skill-downloads/go-performance-analysis-mm8o51ms/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Read, Grep, Glob, Bash

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/go-performance-analysis-mm8o51ms/SKILL.md' && test -s '.skill-downloads/go-performance-analysis-mm8o51ms/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/go-bench' && cp -R '.skill-downloads/go-performance-analysis-mm8o51ms' '.claude/skills/go-bench'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/go-performance-analysis-mm8o51ms'

openskills read 'go-performance-analysis-mm8o51ms'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/go-performance-analysis-mm8o51ms/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills