serejaris/kimi-skills/py-perf-analyzer
Claude Code and agent skill by serejaris/kimi-skills
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
定位 Python 脚本的性能瓶颈,集成 cProfile、tracemalloc 和 line_profiler,一键执行 CPU 热点函数、内存分配或逐行耗时分析,并可输出 JSON 报告。当用户提到优化脚本、分析性能、定位 CPU 或内存热点、进行逐行分析,或询问代码为什么慢、如何加速、内存泄漏等问题时触发。
Install
npx vskill@latest install serejaris/kimi-skills/py-perf-analyzerSKILL.md
The same SKILL.md was published earlier as serejaris/kimi-skills/py-perf-analyzer.
Perf Profiler
Python 性能分析工具,集成 cProfile、line_profiler 和 tracemalloc,一键定位 CPU 和内存瓶颈。
功能
- CPU 分析 (cProfile):统计每个函数的调用次数、累计耗时、自身耗时,定位热点函数
- 内存分析 (tracemalloc):追踪内存分配热点、峰值内存、内存增长来源
- 逐行分析 (line_profiler):精确到每一行代码的耗时和命中次数,适合深入优化
- 组合分析:
all模式一次执行同时收集 CPU + 内存数据,减少重复运行开销
依赖
| 依赖 | 类型 | 用途 | |
|---|---|---|---|
| Python 3.7+ | 必须 | 运行环境 | |
| cProfile / pstats | 内置 | CPU 性能分析 | |
| tracemalloc | 内置 | 内存追踪 | |
| line_profiler | 可选 | 逐行分析(pip install line_profiler) |
使用方式
参数
| 参数 | 说明 | 默认值 | |
|---|---|---|---|
script | 要分析的 Python 脚本路径(必填) | - | |
script_args | 传递给目标脚本的参数 | 无 | |
--mode | 分析模式:cpu / memory / line / all | cpu | |
--top | 显示 Top N 结果 | 20 | |
--sort | CPU 分析排序:cumulative / tottime / calls | cumulative | |
--output | 输出 JSON 报告到文件 | 仅终端输出 | |
--function | 逐行分析的目标函数名(逗号分隔) | 自动发现 | |
--threshold | 只显示占比超过此值(%)的函数 | 0 |
示例
输出说明
CPU 分析报告
内存分析报告
JSON 报告
使用 --output 参数可导出完整的结构化 JSON 报告,包含所有分析维度的详细数据,便于后续处理或接入 CI 流水线。
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/py-perf-analyzer/SKILL.md
Popularity
- Repository stars
- 7
- Repository forks
- 3
- 7-day trend score
- 10
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/serejaris/kimi-skills/py-perf-analyzer)