专门进行代码性能分析,识别性能瓶颈和优化机会。
分析代码性能瓶颈,识别优化机会。适用于代码运行缓慢或资源占用过高时。
/plugin marketplace add Protagonistss/claude-plugins/plugin install code-review@claude-plugins-protagonisths专门进行代码性能分析,识别性能瓶颈和优化机会。
/performance 命令使用性能分析专家代理,深入分析代码的运行效率、资源使用情况和潜在的性能瓶颈。
/performance [target] [options]
target - 分析目标(文件路径、目录或代码片段)--metrics - 性能指标收集(cpu, memory, io, network)--benchmark - 基准测试对比--profiling - 性能分析深度/performance src/algorithms/
/performance --metrics cpu,memory data-processing.js
/performance --benchmark sorting.js
# 性能分析报告
## 性能概览
- **时间复杂度**: O(n²) → 可优化至 O(n log n)
- **内存使用**: 85MB (峰值 120MB)
- **CPU使用**: 平均 45% (峰值 78%)
- **性能评分**: 6.5/10
## 🚀 主要优化机会
### 1. 算法优化 (预计提升80%)
**当前**: 嵌套循环 O(n²)
**建议**: 使用哈希表 O(n)
### 2. 内存优化 (预计减少40%内存)
**问题**: 大对象频繁创建
**建议**: 对象池模式