← スキル一覧に戻る

optimization-techniques
by IvanTorresEdge
⭐ 0🍴 1📅 2026年1月13日
SKILL.md
name: optimization-techniques description: Performance optimization strategies. Use ONLY after profiling identifies bottlenecks.
Optimization Techniques Skill
Performance optimization strategies for Go. ONLY use after profiling!
When to Use
Use ONLY after profiling identifies actual bottlenecks. NEVER optimize prematurely (KISS principle).
Pre-allocate Slices
// Good - pre-allocate when size known
items := make([]Item, 0, expectedSize)
// Bad - repeated allocations
var items []Item
Use strings.Builder
// Good
var b strings.Builder
for _, s := range strings {
b.WriteString(s)
}
result := b.String()
// Bad - repeated allocations
result := ""
for _, s := range strings {
result += s
}
sync.Pool for Reusable Objects
var bufferPool = sync.Pool{
New: func() interface{} {
return new(bytes.Buffer)
},
}
buf := bufferPool.Get().(*bytes.Buffer)
defer bufferPool.Put(buf)
buf.Reset()
// use buf
Minimize Allocations
// Good - reuse buffer
buf := make([]byte, 1024)
for {
n, _ := r.Read(buf)
process(buf[:n])
}
// Bad - allocate each time
for {
buf := make([]byte, 1024)
n, _ := r.Read(buf)
process(buf[:n])
}
Golden Rules
- Profile first - Don't guess
- Measure impact - Benchmark before/after
- KISS principle - Simple first, optimize later
- Maintain readability - Don't sacrifice clarity
- Focus on hot paths - 80/20 rule
スコア
総合スコア
60/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です