소스 정보
- 저장소
- pluginagentmarketplace/custom-plugin-go
- 최근 소스 활동
- 2025년 12월 30일 12:44
- 감지된 SKILL.md 언어
- 영어
- 스타
- 4
- 포크
- 0
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-go --skill go-performance명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| name | go-performance |
| description | Go performance optimization - profiling, benchmarks, memory management |
| sasmp_version | 1.3.0 |
| bonded_agent | 02-go-concurrency |
| bond_type | SECONDARY_BOND |
Optimize Go application performance with profiling and best practices.
Comprehensive performance optimization including CPU/memory profiling, benchmarking, and common optimization patterns.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| profile_type | string | yes | - | Type: "cpu", "memory", "goroutine", "block" |
| duration | string | no | "30s" | Profile duration |
import (
"net/http"
_ "net/http/pprof"
)
func main() {
// Start pprof server
go func() {
http.ListenAndServe("localhost:6060", nil)
}()
// Your application
runApp()
}
# Collect 30s CPU profile
go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30
# Interactive commands
(pprof) top 10 # Top 10 CPU consumers
(pprof) list funcName # Source view
(pprof) web # Open in browser
(pprof) svg > cpu.svg # Export SVG
# Heap profile
go tool pprof http://localhost:6060/debug/pprof/heap
# Allocs since start
go tool pprof http://localhost:6060/debug/pprof/allocs
(pprof) top --cum # By cumulative allocations
(pprof) list funcName # Where allocations happen
func BenchmarkProcess(b *testing.B) {
data := setupData()
b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
Process(data)
}
}
func BenchmarkProcess_Parallel(b *testing.B) {
data := setupData()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
Process(data)
}
})
}
# Run benchmarks
go test -bench=. -benchmem ./...
# Compare benchmarks
go test -bench=. -count=5 > old.txt
# make changes
go test -bench=. -count=5 > new.txt
benchstat old.txt new.txt
// Preallocate slices
func ProcessItems(items []Item) []Result {
results := make([]Result, 0, len(items)) // Preallocate
for _, item := range items {
results = append(results, process(item))
}
return results
}
// Use sync.Pool for frequent allocations
var bufferPool = sync.Pool{
New: func() interface{} {
return new(bytes.Buffer)
},
}
func GetBuffer() *bytes.Buffer {
buf := bufferPool.Get().(*bytes.Buffer)
buf.Reset()
return buf
}
func PutBuffer(buf *bytes.Buffer) {
bufferPool.Put(buf)
}
# Check what escapes to heap
go build -gcflags="-m -m" ./...
# Common escapes
# - Returning pointers to local variables
# - Storing in interface{}
# - Closures capturing variables
// String building - use strings.Builder
var b strings.Builder
for _, s := range parts {
b.WriteString(s)
}
result := b.String()
// Avoid interface{} in hot paths
// Use generics or concrete types
// Reduce allocations in loops
buffer := make([]byte, 1024)
for {
n, err := reader.Read(buffer)
// reuse buffer
}
# Goroutine profile (leak detection)
go tool pprof http://localhost:6060/debug/pprof/goroutine
# Block profile (contention)
go tool pprof http://localhost:6060/debug/pprof/block
# Mutex profile
go tool pprof http://localhost:6060/debug/pprof/mutex
# Trace (detailed execution)
curl -o trace.out http://localhost:6060/debug/pprof/trace?seconds=5
go tool trace trace.out
| Symptom | Cause | Fix |
|---|---|---|
| High CPU | Hot loop, GC | Profile, reduce allocs |
| High memory | Leak, no pooling | Heap profile, sync.Pool |
| Slow start | Large init | Lazy initialization |
| GC pauses | Many allocations | Reduce allocations |
Skill("go-performance")
SOC 직업 분류 기준