← 返回
未分类

Performance Profiling

性能分析速查。当需要:(1) Python 性能分析 (2) Node.js 性能分析 (3) 数据库优化 (4) 系统性能监控时使用。
性能分析速查,用于 Python/Node.js 性能分析、数据库优化和系统性能监控。
afine907
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 252
下载
💾 0
安装
1
版本
#latest

概述

Performance Profiling

性能分析和调优工具速查。

快速参考

Python 分析

python -m cProfile script.py
python -m cProfile -s cumtime script.py
pip install py-spy && py-spy top --pid 12345

Node.js 分析

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                    # 综合

详细参考

常见优化

Python

# 字符串拼接
result = "".join(strings)   # 而非 for + loop

# 使用生成器
result = (x for x in range(1000000))

# 内置函数更快
total = sum(numbers)

数据库

  • 添加合适索引
  • 避免全表扫描
  • 使用 EXPLAIN 分析
  • 缓存热点数据

文档

  • Python profiling: https://docs.python.org/3/library/profile.html
  • clinic.js: https://clinicjs.org/
  • FlameGraph: https://www.brendangregg.com/flamegraphs.html

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-21 15:35 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

AI Commit Message Generator

afine907
分析暂存的更改并自动生成语义化的提交信息。读取 git diff --staged,分析代码更改,生成符合约定的提交信息。
★ 0 📥 263

Commit Diff Analyzer

afine907
分析两次 Git 提交之间的代码变更。用户提供两个提交 ID 时使用,用于了解两者之间的改动,包括文件修改等。
★ 0 📥 254

Python Testing

afine907
Python 测试速查:运行 pytest、使用 mock/patch、参数化、fixtures、异步、覆盖率测试。
★ 0 📥 336