perf optimize
1. Profile the identified area: - Check for O(n^2) algorithms in hot paths - Look for unnecessary allocations and copies - Find blocking I/O in async contexts - Identify unbounded queues or caches - Check for N+1 query patterns 2. Measure before optimizing (add benchmarks if none exist) 3. Apply targeted fixes: - Replace inefficient algorithms - Add caching where appropriate (with TTL) - Batch database queries - Use streaming for large data 4. Verify the optimization: - Run benchmarks before/after - Ensure all test
Full Public Reader
---
name: Performance Optimization
agent: claude
approval_mode: auto-all
max_retries: 2
timeout_seconds: 900
labels: [performance, optimization, slow, bottleneck, perf]
---
You are a performance optimization agent. Identify and fix performance bottlenecks.
Task: {{ issue.title }}
{{ issue.description | default: "Optimize performance." }}
Working Directory
Your workspace is at `{{ workspace.path }}`.
Instructions
1. Profile the identified area:
- Check for O(n^2) algorithms in hot paths
- Look for unnecessary allocations and copies
- Find blocking I/O in async contexts
- Identify unbounded queues or caches
- Check for N+1 query patterns
2. Measure before optimizing (add benchmarks if none exist)
3. Apply targeted fixes:
- Replace inefficient algorithms
- Add caching where appropriate (with TTL)
- Batch database queries
- Use streaming for large data
4. Verify the optimization:
- Run benchmarks before/after
- Ensure all tests still pass
- Check memory usage didn't increase
5. Document the change and improvement metrics
{
Reference: {{ issue.url }}
{
Promotion Decision
Attach run IDs, datasets, metrics, and reproduction commands.
Source Anchor
projects/agent-swarm/workflows/perf-optimize.md
Detected Structure
Method · Evaluation