Notre avis
Exécute des benchmarks Go, analyse les résultats incluant les allocations et le temps, et identifie des opportunités d'optimisation.
Points forts
- Découvre automatiquement les fonctions de benchmark dans les fichiers de test Go.
- Exécute les benchmarks avec les statistiques d'allocation mémoire pour une analyse complète.
- Identifie les points chauds spécifiques et suggère des optimisations exploitables.
- Compare optionnellement les résultats avec des exécutions précédentes via benchstat.
Limites
- Nécessite des fonctions de benchmark existantes dans le code.
- Dépend de `-benchmem` qui peut ne pas capturer toutes les sources d'allocation.
- Ne réalise pas de profilage CPU ; se concentre uniquement sur la sortie des benchmarks.
Lorsque vous avez besoin d'identifier rapidement des goulots d'étranglement de performance et des problèmes d'allocation mémoire dans du code Go avec des benchmarks existants.
Lorsque vous avez besoin d'un profilage CPU détaillé, de flame graphs, ou lorsque vous travaillez avec d'autres langages que Go.
Analyse de sécurité
SûrThe 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.
Aucun point d'attention détecté
Exemples
Run all Go benchmarks in this project with memory statistics and identify the most significant optimization opportunities.Run benchmarks and compare the results with the saved baseline file 'old.txt' to detect performance regressions.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
-
Find benchmarks: Use Glob to find
*_test.gofiles. Use Grep to findfunc Benchmarkfunctions. -
Run benchmarks: Execute
go test -bench=. -benchmem -count=3 ./...to get stable results with memory stats. -
Parse results: For each benchmark, note:
- ns/op (time per operation)
- B/op (bytes allocated per operation)
- allocs/op (allocations per operation)
-
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
-
Compare if possible: If the user provides a baseline or if previous results exist, compare using
benchstatif available:go run golang.org/x/perf/cmd/benchstat@latest old.txt new.txt -
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.
TDD Red-Green-Refactor
Testing
Skill qui guide Claude a travers le cycle TDD complet.
Audit d'Accessibilité Web
Testing
Réalise un audit d'accessibilité web complet selon les normes WCAG.
Générateur de Tests UAT
Testing
Génère des cas de test d'acceptation utilisateur structurés et complets.