‹ 首页

performance-optimization

@developersglobal · 收录于 1 周前

Measure first, optimize second. Data-driven performance improvements with before/after benchmarks and production validation.

适合你,如果需要在生产环境做数据驱动的性能优化

/ 下载安装
performance-optimization.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add developersglobal/ai-agent-skills/performance-optimization
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- developersglobal/ai-agent-skills/performance-optimization
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify developersglobal/ai-agent-skills/performance-optimization
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
64GitHub stars
~616上下文体积 · 单文件
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · f47f948
Overview

Premature optimization is the root of all evil. But ignoring performance until it's a crisis is equally harmful. This skill enforces data-driven optimization: profile first, optimize the bottleneck, measure the improvement.

When to Use
  • When performance issues are reported in production
  • Before optimizing any code (to ensure you're optimizing the right thing)
  • When reviewing changes that touch performance-sensitive paths
Process
Step 1: Measure the Baseline
  1. Reproduce the performance issue reliably.
  2. Measure current performance: latency p50/p95/p99, throughput, memory, CPU.
  3. Profile to find the actual bottleneck — not where you think it is.
  4. Write the performance test you'll use to validate improvement.

Verify: You have concrete baseline numbers, not gut feelings.

Step 2: Identify the Real Bottleneck
  1. Use profiling tools: flame graphs, CPU profiles, memory profiles.
  2. Find the top 3 hotspots by actual execution time (not lines of code).
  3. The bottleneck is rarely where you expect it to be. Trust the data.

Verify: Bottleneck identified by profiling data, not assumption.

Step 3: Optimize Only the Bottleneck
  1. Fix only the profiled bottleneck — nothing else.
  2. Common optimizations by type:
  3. CPU: Algorithmic improvement (O(n²) → O(n log n)), caching, batching
  4. Memory: Streaming instead of buffering, object pooling, lazy loading
  5. I/O: Connection pooling, N+1 query elimination, caching, async/parallel calls
  6. AI: Prompt caching, batch inference, smaller models for simpler tasks

Verify: Change targets the profiled bottleneck, not speculative improvements.

Step 4: Measure the Improvement
  1. Run the same performance test from Step 1.
  2. Compare before vs. after metrics.
  3. If improvement < 20%: the optimization may not be worth the complexity.

Verify: Improvement measured with the same test harness as baseline.

Common Rationalizations (and Rebuttals)

| Excuse | Rebuttal | |--------|----------| | "I know where the bottleneck is" | You're probably wrong. Profile first. | | "This is clearly slow" | "Clearly slow" rarely matches profiler output. Measure. | | "We'll optimize later" | If it's slow enough to mention, it's slow enough to measure now. |

Verification
  • [ ] Baseline metrics captured before any optimization
  • [ ] Bottleneck identified by profiler (not assumption)
  • [ ] Optimization targets only the profiled bottleneck
  • [ ] Improvement measured with same test harness
  • [ ] Before/after numbers documented
References
  • [references/performance-checklist.md](../../references/performance-checklist.md)
  • [observability skill](../observability/SKILL.md)
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。