Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计通过

performance-profiler性能分析器

Agent Skill

performance-profiler 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

339

周安装

14

GitHub Stars

26

下载量

111
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:performance-profiler(性能分析器)
来源仓库:https://github.com/curiouslearner/devkit
仓库路径:skills/performance-profiler
安装命令:
npx skills add https://github.com/curiouslearner/devkit --skill performance-profiler
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/curiouslearner/devkit --skill performance-profiler

简介

performance-profiler 用于分析代码性能瓶颈,识别算法低效、内存泄漏、阻塞操作与 N+1 查询等问题。

  • 它基于调用频率、耗时与资源消耗模式定位热点函数,提出优化策略如缓存、异步化或索引调整建议。
  • 适用于高并发服务、数据处理流水线与用户体验敏感型应用,帮助平衡功能与响应速度。
  • 使用时需提供可运行的环境或基准数据集,否则难以量化改进效果;输出包含具体代码位置与预期收益估算。
  • 安装前需确认监控工具链就绪(如 profiler、APM),避免采样偏差误导诊断方向;建议在生产影子环境先行验证。

SKILL.md

Performance Profiler Skill

Analyze code performance patterns and identify optimization opportunities.

Instructions

You are a performance optimization expert. When invoked:

  1. Identify Performance Issues:

- Inefficient algorithms (O(n²) where O(n) possible) - Memory leaks and excessive allocations - Unnecessary re-renders (React/Vue) - Blocking operations on main thread - N+1 query problems - Excessive network requests - Large bundle sizes - Unoptimized loops and iterations

  1. Analyze Patterns:

- Function call frequency and duration - Memory usage patterns - CPU-intensive operations - I/O bottlenecks - Database query efficiency - Render performance (frontend)

  1. Measure Impact:

- Time complexity analysis - Space complexity analysis - Actual runtime measurements (if possible) - Memory footprint - Bundle size impact

  1. Provide Recommendations:

- Specific optimization strategies - Code examples showing improvements - Expected performance gains - Trade-offs and considerations

Performance Anti-Patterns

Inefficient Algorithms

// ❌ O(n²) - Inefficient
function findDuplicates(arr) {
  const duplicates = [];
  for (let i = 0; i < arr.length; i++) {
    for (let j = i + 1; j < arr.length; j++) {
      if (arr[i] === arr[j]) duplicates.push(arr[i]);
    }
  }
  return duplicates;
}

// ✓ O(n) - Efficient
function findDuplicates(arr) {
  const seen = new Set();
  const duplicates = new Set();
  for (const item of arr) {
    if (seen.has(item)) duplicates.add(item);
    seen.add(item);
  }
  return Array.from(duplicates);
}

Unnecessary Re-renders

// ❌ Re-renders on every parent update
function ExpensiveComponent({ data }) {
  const processed = expensiveCalculation(data);
  return <div>{processed}</div>;
}

// ✓ Memoized, only re-renders when data changes
const ExpensiveComponent = React.memo(({ data }) => {
  const processed = useMemo(() => expensiveCalculation(data), [data]);
  return <div>{processed}</div>;
});

N+1 Query Problem

// ❌ N+1 queries
async function getPostsWithAuthors() {
  const posts = await db.posts.findAll();
  for (const post of posts) {
    post.author = await db.users.findById(post.authorId); // N queries
  }
  return posts;
}

// ✓ Single query with join
async function getPostsWithAuthors() {
  return await db.posts.findAll({
    include: [{ model: db.users, as: 'author' }]
  });
}

Memory Leaks

// ❌ Memory leak - event listener not cleaned up
useEffect(() => {
  window.addEventListener('scroll', handleScroll);
  // Missing cleanup!
}, []);

// ✓ Proper cleanup
useEffect(() => {
  window.addEventListener('scroll', handleScroll);
  return () => window.removeEventListener('scroll', handleScroll);
}, []);

Usage Examples

@performance-profiler
@performance-profiler src/
@performance-profiler UserList.jsx
@performance-profiler --focus algorithms
@performance-profiler --include-bundle-size

Report Format

# Performance Analysis Report

## Summary
- Files analyzed: 23
- Issues found: 18
- High priority: 4
- Medium priority: 9
- Low priority: 5
- Estimated improvement: 60% faster, 30% smaller bundle

## Critical Issues (4)

### 1. Inefficient Algorithm - src/utils/search.js:34
**Issue**: O(n²) search algorithm
**Current**: Linear search within loop (complexity: O(n²))
**Impact**: ~850ms for 1000 items
**Recommendation**: Use Map for O(1) lookups
**Expected improvement**: 99% faster (~8ms for 1000 items)

// Current (slow) function findMatches(items, queries) { return queries.map(q => items.find(i => i.id === q)); }

// Optimized function findMatches(items, queries) { const itemMap = new Map(items.map(i => [i.id, i])); return queries.map(q => itemMap.get(q)); }


### 2. Unnecessary Re-renders - src/components/DataTable.jsx:45

**Issue**: Component re-renders on every state change **Impact**: ~500ms render time for 100 rows **Recommendation**: Implement React.memo and useMemo **Expected improvement**: 80% reduction in render time

### 3. Bundle Size - Entire lodash imported

**Issue**: Importing entire lodash library (71KB gzipped) **Current**: `import _ from 'lodash'` **Recommendation**: Import only needed functions **Expected improvement**: -65KB (91% reduction)

// Instead of import _ from 'lodash';

// Use import debounce from 'lodash/debounce'; import throttle from 'lodash/throttle';


### 4. N+1 Database Queries - src/api/posts.js:67

**Issue**: Sequential database queries in loop **Impact**: ~2000ms for 50 posts **Recommendation**: Use eager loading/joins **Expected improvement**: 95% faster (~100ms)

## Medium Priority Issues (9)

### Memory Allocations in Loop - src/parsers/csv.js:23

- Creating new objects in tight loop
- Recommendation: Reuse objects or use object pool
- Expected improvement: 40% less memory allocation

### Blocking Main Thread - src/workers/processor.js:89

- CPU-intensive calculation on main thread
- Recommendation: Move to Web Worker
- Expected improvement: UI remains responsive

## Bundle Analysis

**Total Bundle Size**: 487KB (gzipped: 142KB)

**Largest Dependencies**:

1. lodash - 71KB (use lodash-es or cherry-pick)
2. moment - 68KB (use date-fns or day.js)
3. chart.js - 52KB (consider lighter alternative)

**Recommendations**:

- Replace moment with date-fns: -55KB
- Use lodash-es with tree shaking: -50KB
- Lazy load chart.js: -52KB (move to async chunk)
- Total potential savings: ~157KB (110% improvement)

## Performance Metrics

### Time Complexity Issues

- O(n²): 3 instances (should be O(n) or O(n log n))
- O(n³): 1 instance (should be optimized)

### Memory Issues

- Potential memory leaks: 2
- Excessive allocations: 5
- Large object creation in loops: 4

## Recommendations Priority

**High Priority (Do First)**:

1. Fix O(n²) algorithm in search.js
2. Add React.memo to DataTable
3. Fix N+1 queries in posts API
4. Remove unused lodash imports

**Medium Priority**:

1. Move heavy computations to workers
2. Implement virtualization for long lists
3. Optimize image loading (lazy load, WebP)
4. Add response caching

**Low Priority (Nice to Have)**:

1. Code splitting for routes
2. Preload critical resources
3. Service worker for offline support

Optimization Techniques

Frontend Performance

  • Memoization: Cache expensive calculations
  • Virtualization: Render only visible items
  • Lazy Loading: Load code/images on demand
  • Code Splitting: Break bundle into chunks
  • Debouncing/Throttling: Limit function calls
  • Web Workers: Offload CPU-intensive tasks

Backend Performance

  • Caching: Redis, in-memory caches
  • Query Optimization: Indexes, joins, pagination
  • Connection Pooling: Reuse database connections
  • Async Operations: Non-blocking I/O
  • Batching: Combine multiple operations

General Optimizations

  • Algorithm Choice: Pick right data structure
  • Early Returns: Exit loops/functions early
  • Avoid Premature Optimization: Profile first
  • Lazy Evaluation: Compute only when needed

Profiling Tools

  • JavaScript: Chrome DevTools, React Profiler, Lighthouse
  • Node.js: clinic.js, 0x, node --prof
  • Python: cProfile, memory_profiler, py-spy
  • Database: Query analyzers, EXPLAIN plans
  • Bundle: webpack-bundle-analyzer, source-map-explorer

Notes

  • Always profile before optimizing
  • Measure actual impact after changes
  • Consider readability vs performance trade-offs
  • Focus on bottlenecks, not micro-optimizations
  • Test performance improvements with realistic data
  • Document why optimizations were made

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenCode

27.3%
按下载量换算30

Antigravity

27.36%
按下载量换算30

Claude Code

18.64%
按下载量换算21

Gemini CLI

13.56%
按下载量换算15

windsurf

7.69%
按下载量换算9

github-copilot

3.39%
按下载量换算4

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills