mcpField
P
performance-profiler

performance-profiler

github.com/alirezarezvani开发28.9k727 次安装2 天前更新
代码仓库

关于 performance-profiler

面向工程团队的性能分析技能,覆盖 Node.js、Python 和 Go 应用。它指导团队定位 CPU、内存、I/O、数据库及负载问题,并强调优化前后测量。

主要功能

  1. 01分析 CPU 性能并生成火焰图
  2. 02检查内存使用与泄漏
  3. 03分析应用打包体积
  4. 04优化数据库查询
  5. 05使用 k6 和 Artillery 进行负载测试
  6. 06建立优化前后性能基线

适用场景

  1. 01定位应用响应缓慢的瓶颈
  2. 02排查内存持续增长问题
  3. 03发布前验证 P99 延迟
  4. 04上线前测试流量峰值承载能力

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/alirezarezvani/claude-skills --skill performance-profiler

安装后在 Claude Code 中输入/performance-profiler确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
optimization-playbook.md
profiling-recipes.md
scripts/
performance_profiler.py

详细介绍

Performance Profiler

Tier: POWERFUL
Category: Engineering
Domain: Performance Engineering


Overview

针对 Node.js、Python 和 Go 应用进行系统化性能分析。识别 CPU、内存和 I/O 瓶颈;生成火焰图;分析打包体积;优化数据库查询;检测内存泄漏;并使用 k6 和 Artillery 运行负载测试。始终在优化前后进行测量。

Core Capabilities

  • CPU profiling — Node.js 火焰图、Python 的 py-spy、Go 的 pprof
  • Memory profiling — 堆快照、内存泄漏检测、GC 压力分析
  • Bundle analysis — webpack-bundle-analyzer、Next.js 打包分析器
  • Database optimization — EXPLAIN ANALYZE、慢查询日志、N+1 检测
  • Load testing — k6 脚本、Artillery 场景、逐步加压模式
  • Before/after measurement — 建立基线、性能分析、优化、验证

When to Use

  • 应用运行缓慢,且不清楚瓶颈所在
  • 发布前 P99 延迟超出 SLA
  • 内存占用随时间增长(疑似内存泄漏)
  • 添加依赖后打包体积增大
  • 为流量高峰做准备(上线前进行负载测试)
  • 数据库查询耗时超过 100ms

Quick Start

# Analyze a project for performance risk indicators
python3 scripts/performance_profiler.py /path/to/project

# JSON output for CI integration
python3 scripts/performance_profiler.py /path/to/project --json

# Custom large-file threshold
python3 scripts/performance_profiler.py /path/to/project --large-file-threshold-kb 256

Golden Rule: Measure First

# Establish baseline BEFORE any optimization
# Record: P50, P95, P99 latency | RPS | error rate | memory usage

# Wrong: "I think the N+1 query is slow, let me fix it"
# Right: Profile → confirm bottleneck → fix → measure again → verify improvement

Node.js Profiling

→ 详见 references/profiling-recipes.md

References

评论

支持 Markdown