go-performance-testing
Design, run, compare, and interpret Go performance evidence using benchmarks, B.Loop, benchstat, pprof, traces, escape analysis, cache locality, fal…
它会碰到什么
这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。
技能内容
Go Performance Testing
Optimize only after establishing a representative, repeatable measurement and a
specific hypothesis.
Core Workflow
- Define the user-visible metric and representative workload.
- Stabilize correctness before measuring performance.
- Write focused benchmarks with realistic inputs and controlled setup.
- Collect repeated baseline samples in comparable conditions.
- Use allocations, profiles, and traces to form a causal hypothesis.
- Make one bounded change.
- Compare repeated before/after samples statistically.
- Recheck correctness and the end-to-end workload.
Read Next
| Task | Load |
|---|---|
| Benchmark a function or package | guidelines.md, workflows/benchmark-code.md |
| Investigate a regression | workflows/investigate-performance.md |
| Evaluate profile-guided optimization | workflows/evaluate-pgo.md |
| Choose benchmark and profile controls | references/performance-testing/rules.md |
| Interpret metrics and profiles | references/performance-testing/knowledge.md |
| Review benchmark patterns | references/performance-testing/examples.md |
Guardrails
- Do not optimize from one benchmark line or an unrepresentative microbenchmark.
- Do not compare runs made under materially different environments.
- Do not treat coverage or race detection as performance evidence.
- Name the profile sample type and distinguish flat from cumulative cost.
- Prefer
B.Looponly when the pinned Go version supports it. - Keep production profile endpoints protected and operationally controlled.
- Do not encode cache-line size, escape output, or inliner budgets as portable facts.
- Do not use
sync.Poolas a cache or resource owner.
Source Notes
Guidance is transformed and paraphrased from Inanc Gumus, *Go by Example:
Programmer's Guide to Idiomatic and Testable Programs* (Manning, 2025),
especially Chapter 3. Examples are original.
Diagnostics, locality, allocation, GC, and container guidance also incorporates
transformed material from Teiva Harsanyi, *100 Go Mistakes and How to Avoid
Them* (Manning, 2022), Chapter 12.
Book: https://www.manning.com/books/go-by-example
Verify current behavior against https://pkg.go.dev/testing,
https://go.dev/doc/diagnostics, and https://go.dev/doc/pgo.
想直接用这个技能?
本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。
它属于哪个仓库
plugins/LVTD-LLC/skills/skills/go-performance-testing/SKILL.md