Install
openclaw skills install performance-profiling性能分析速查。当需要:(1) Python 性能分析 (2) Node.js 性能分析 (3) 数据库优化 (4) 系统性能监控时使用。
openclaw skills install performance-profiling性能分析和调优工具速查。
python -m cProfile script.py
python -m cProfile -s cumtime script.py
pip install py-spy && py-spy top --pid 12345
node --prof app.js
node --cpu-prof app.js
npm install -g clinic && clinic doctor -- node app.js
-- MySQL
EXPLAIN ANALYZE SELECT * FROM users WHERE name = 'Alice';
SHOW PROCESSLIST;
-- PostgreSQL
EXPLAIN ANALYZE SELECT * FROM users WHERE name = 'Alice';
SELECT * FROM pg_stat_activity;
top -o %CPU # CPU
iostat -x 1 # I/O
vmstat 1 # 综合
# 字符串拼接
result = "".join(strings) # 而非 for + loop
# 使用生成器
result = (x for x in range(1000000))
# 内置函数更快
total = sum(numbers)