profiling-optimization by aj-geddes/useful-ai-prompts
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill profiling-optimization通过分析代码执行情况,识别性能瓶颈,并采用数据驱动的方法优化关键路径。
最小工作示例:
import { performance, PerformanceObserver } from "perf_hooks";
class Profiler {
private marks = new Map<string, number>();
mark(name: string): void {
this.marks.set(name, performance.now());
}
measure(name: string, startMark: string): number {
const start = this.marks.get(startMark);
if (!start) throw new Error(`Mark ${startMark} not found`);
const duration = performance.now() - start;
console.log(`${name}: ${duration.toFixed(2)}ms`);
return duration;
}
async profile<T>(name: string, fn: () => Promise<T>): Promise<T> {
const start = performance.now();
try {
return await fn();
} finally {
// ... (完整实现请参阅参考指南)
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
references/ 目录下的详细实现:
| 指南 | 内容 |
|---|---|
| Node.js Profiling | Node.js 性能分析 |
| Chrome DevTools CPU Profile | Chrome DevTools CPU 性能分析 |
| Python cProfile | Python cProfile |
| Benchmarking | 基准测试 |
| Database Query Profiling | 数据库查询分析 |
| Flame Graph Generation | 火焰图生成 |
每周安装量
116
代码仓库
GitHub 星标数
126
首次出现
2026年1月21日
安全审计
安装于
opencode100
gemini-cli96
codex94
cursor90
claude-code87
github-copilot82
Profile code execution to identify performance bottlenecks and optimize critical paths using data-driven approaches.
Minimal working example:
import { performance, PerformanceObserver } from "perf_hooks";
class Profiler {
private marks = new Map<string, number>();
mark(name: string): void {
this.marks.set(name, performance.now());
}
measure(name: string, startMark: string): number {
const start = this.marks.get(startMark);
if (!start) throw new Error(`Mark ${startMark} not found`);
const duration = performance.now() - start;
console.log(`${name}: ${duration.toFixed(2)}ms`);
return duration;
}
async profile<T>(name: string, fn: () => Promise<T>): Promise<T> {
const start = performance.now();
try {
return await fn();
} finally {
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Node.js Profiling | Node.js Profiling |
| Chrome DevTools CPU Profile | Chrome DevTools CPU Profile |
| Python cProfile | Python cProfile |
| Benchmarking | Benchmarking |
| Database Query Profiling | Database Query Profiling |
| Flame Graph Generation | Flame Graph Generation |
Weekly Installs
116
Repository
GitHub Stars
126
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode100
gemini-cli96
codex94
cursor90
claude-code87
github-copilot82
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
120,000 周安装
TypeScript性能优化指南:45条最佳实践规则,提升编译速度与类型安全
686 周安装
Remotion 教程:使用 React 框架编程创建视频动画与数据可视化
696 周安装
Knowledge Site Creator - AI自动生成知识学习网站,支持闪卡、测试、进度追踪
695 周安装
Polymarket API 集成指南:Python 交易接口与区块链预测市场开发
701 周安装
HeyGen数字人视频API教程:创建AI虚拟人视频,控制形象、语音、脚本和场景
749 周安装
YouTube视频分析师 - 逆向分析病毒内容公式,提取钩子、留存机制与情感触发点
724 周安装