首页龙虾技能列表 › OpenClaw Performance — OpenClaw 性能

OpenClaw Performance — OpenClaw 性能

v1.1.0

OpenClaw 性能工具。

0· 77·0 当前·0 累计
by @michealxie001·MIT-0
下载技能包
License
MIT-0
最后更新
2026/4/2
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
medium confidence
The skill's code, instructions, and requirements are coherent with a local performance-analysis tool — it reads and analyzes source files and does not request credentials or remote installs — but the shipped script contains quality issues and you should review/run it in a sandbox before use.
评估建议
This skill appears to be what it says: a local performance analysis tool that reads your source files and prints suggestions. Before installing or running it: - Review scripts/main.py (and any additional shipped modules) for hidden network calls, subprocess.exec, or file writes. The provided snippet shows only AST/static checks, but review the remainder of the file. - Be careful when following the 'profile' advice: profiling runs your code (cProfile/kernprof). Do not profile untrusted code on a...
详细分析 ▾
用途与能力
Name/description (performance analysis, profiling, bottleneck detection) align with the provided SKILL.md and the included scripts/main.py analyzer. The skill requires no external credentials, binaries, or installs — which is appropriate for a local static/dynamic analysis tool.
指令范围
SKILL.md instructs the agent/user to run the included script against local source files and to use cProfile/kernprof for profiling. Reading and analyzing repo files is expected for this purpose. There are no instructions to transmit data externally or to read unrelated system configuration. Note: profiling suggestions require running target code — running untrusted code is a security risk (this is a user operational risk rather than a misbehavior of the skill).
安装机制
No install spec; instruction-only plus included scripts. Nothing is downloaded or extracted from remote URLs. This minimizes supply-chain risk.
凭证需求
The skill declares no required environment variables, credentials, or config paths. The SKILL.md and code do not appear to access environment secrets. This is proportionate to the claimed functionality.
持久化与权限
always is false and there's no request for persistent system modification or to change other skills' configs. The skill runs only when invoked.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.1.02026/4/2

Added C/C++ support: performance analysis, I/O detection, memory allocation analysis

● 无害

安装命令 点击复制

官方npx clawhub@latest install oc-performance
镜像加速npx clawhub@latest install oc-performance --registry https://cn.clawhub-mirror.com

技能文档

性能分析工具,分析代码执行、识别瓶颈、提供优化建议。

Version: 1.1 Features: 性能分析、瓶颈识别、优化建议、基准测试、C/C++ 支持 (新的)


Quick 开始

1. 分析 Python 代码

# 分析函数执行时间
python3 scripts/main.py profile --file src/main.py --function process_data

# 分析整个模块 python3 scripts/main.py profile --file src/main.py

2. 识别瓶颈

# 扫描代码中的性能问题
python3 scripts/main.py analyze --file src/main.py

# 分析目录 python3 scripts/main.py analyze --dir src/

3. 基准测试

# 运行基准测试
python3 scripts/main.py benchmark --file src/main.py --function heavy_computation

Commands

命令说明示例
profile性能分析profile --file src.py
analyze瓶颈分析analyze --file src.py
benchmark基准测试benchmark --function foo

个人资料 输出

$ python3 scripts/main.py profile --file src/processor.py --function process_data

🔍 Performance Profile ======================

Function: process_data File: src/processor.py:45 Calls: 100 Total time: 2.34s Avg time: 23.4ms

Top hotspots: 45% - database.query() (line 67) 30% - json.dumps() (line 89) 15% - data transformation (line 78) 10% - other

Recommendations: ⚠️ Consider caching database results ⚠️ Use orjson instead of json for better performance


瓶颈分析

$ python3 scripts/main.py analyze --file src/api.py

🔍 Performance Analysis =======================

File: src/api.py Issues found: 3

🔴 High Impact: Line 34: Nested loop O(n²) for user in users: for order in orders: # ← N+1 query pattern Suggestion: Use JOIN query instead

🟡 Medium Impact: Line 67: String concatenation in loop result += item # ← Use list + join instead

🟢 Low Impact: Line 89: Unused import import heavy_module # ← Remove if not used


基准测试

$ python3 scripts/main.py benchmark --file src/sort.py --function quicksort

⏱️ Benchmark Results ====================

Function: quicksort Iterations: 1000

Time (ms): Mean: 12.34 Median: 11.89 Min: 8.45 Max: 45.67 P95: 18.90 P99: 32.10

Memory (MB): Mean: 2.45 Peak: 4.12

Comparison: vs bubble sort: 45x faster vs merge sort: 1.2x faster


检测的优化模式

代码层面

问题检测建议
N+1 查询使用 JOIN / select_related
循环内字符串拼接使用 list + join
未使用的导入移除导入
嵌套循环优化算法或使用哈希
重复计算缓存结果

Python 特定

问题检测建议
list vs generator大数据用 generator
dict.get() vs []使用 .get() 避免 KeyError
列表推导式替代 map/filter

Configuration

.performance.json:

{
  "benchmark_iterations": 1000,
  "warmup_iterations": 10,
  "profile_lines": true,
  "check_patterns": [
    "n_plus_one",
    "string_concat_in_loop",
    "unused_imports"
  ]
}

CI/CD 集成

# .github/workflows/performance.yml
name: Performance Check
on: [pull_request]

jobs: perf: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Analyze Performance run: python3 skills/performance/scripts/main.py analyze --dir src/ - name: Run Benchmarks run: python3 skills/performance/scripts/main.py benchmark --all


Files

skills/performance/
├── SKILL.md                    # 本文件
└── scripts/
    ├── main.py                 # ⭐ 统一入口
    ├── profiler.py             # 性能分析器
    └── analyzer.py             # 瓶颈分析器

Roadmap

  • [x] Basic profiling
  • [x] Bottleneck detection
  • [x] Benchmark runner
  • [ ] Memory profiling
  • [ ] Flame 图形 generation
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务