← Back to list

go-testing-benchmarks
by JamesPrial
WIP - collection of various Claude stuff i make/use/have_Claude_hallucinate
⭐ 2🍴 0📅 Jan 23, 2026
SKILL.md
name: go-testing-benchmarks description: Benchmark patterns for performance testing
Benchmarks
Measure function performance with benchmark tests.
CORRECT
func Benchmark_Fibonacci(b *testing.B) {
for i := 0; i < b.N; i++ {
Fibonacci(10)
}
}
func Benchmark_Fibonacci_Cases(b *testing.B) {
cases := []struct {
name string
n int
}{
{name: "small", n: 10},
{name: "medium", n: 20},
{name: "large", n: 30},
}
for _, bc := range cases {
b.Run(bc.name, func(b *testing.B) {
for i := 0; i < b.N; i++ {
Fibonacci(bc.n)
}
})
}
}
func Benchmark_StringConcat(b *testing.B) {
b.ResetTimer() // Exclude setup time
for i := 0; i < b.N; i++ {
_ = "hello" + "world"
}
}
Run benchmarks:
go test -bench=. -benchmem
Why:
- b.N adjusted automatically for stable timing
- Sub-benchmarks compare variations
- b.ResetTimer() excludes setup
- -benchmem shows allocation stats
WRONG
func Benchmark_Fibonacci(b *testing.B) {
Fibonacci(10) // Missing loop
}
func Benchmark_NoReset(b *testing.B) {
// Expensive setup
data := generateLargeData()
// Missing b.ResetTimer()
for i := 0; i < b.N; i++ {
Process(data)
}
}
Problems:
- No b.N loop = invalid benchmark
- Setup time included in measurement
- Inaccurate performance results
Score
Total Score
65/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
✓最近の活動
1ヶ月以内に更新
+10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
Reviews
💬
Reviews coming soon
