Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Analyze and suggest performance improvements for code, queries, or systems
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 21% | 0% |
| case-02 | ✗→✓ | ▲ Improved | -18% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 251% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 116% | 0% |
| case-03 | ✓→✓ | = Same ✓ | -16% | 0% |
Analyze and suggest performance improvements for code, queries, or systems.
Identify optimization opportunities:
Determine optimization target:
bash# Find potentially slow patterns grep -rn "forEach\|\.map\|\.filter\|\.reduce" --include="*.{ts,js}" . | head -20 # Find nested loops (O(n²) potential) grep -rn "for.*for\|\.forEach.*\.forEach\|\.map.*\.map" --include="*.{ts,js}" . | head -10 # Find sync operations that could be async grep -rn "readFileSync\|writeFileSync\|execSync" --include="*.{ts,js}" . | head -10
bash# Large array operations grep -rn "new Array\|Array\.from\|\.concat\|spread" --include="*.{ts,js}" . | head -10 # Potential memory leaks (event listeners, intervals) grep -rn "addEventListener\|setInterval\|setTimeout" --include="*.{ts,js}" . | head -10
bash# N+1 query patterns grep -rn "await.*find\|await.*query" --include="*.{ts,js}" . | head -15 # Missing indexes hints grep -rn "WHERE\|ORDER BY\|GROUP BY" --include="*.{ts,js,sql}" . | head -15
bash# Check bundle size (if applicable) [ -f "package.json" ] && npm run build 2>/dev/null && ls -lh dist/*.js 2>/dev/null # Large dependencies [ -f "package.json" ] && cat package.json | jq '.dependencies | keys[]' | head -20
Rank findings by:
Target: file/module/system] Analysis Date: timestamp]
| Metric | Current | Target | Gap | |--------|---------|--------|-----| | Response time | Xms | <Yms | -Z% needed | | Memory usage | XMB | <YMB | -Z% needed | | Bundle size | XKB | <YKB | -Z% needed |
Problem: What's slow and why]
Current:
typescript// O(n²) - nested loops users.forEach(user => { permissions.forEach(perm => { if (user.id === perm.userId) { ... } }); });
Optimized:
typescript// O(n) - Map lookup const permMap = new Map(permissions.map(p => [p.userId, p])); users.forEach(user => { const perm = permMap.get(user.id); if (perm) { ... } });
Impact: ~10x faster for 1000 users Effort: Low (5 min) Risk: Low
| Issue | Location | Impact | Effort | |-------|----------|--------|--------| | description] | file:line | estimate] | time] |
| Issue | Location | Impact | Effort | |-------|----------|--------|--------| | description] | file:line | estimate] | time] |
Week 1: Critical fixes (items 1-3)
Week 2: High priority (items 4-6)
Week 3: Measure and validate improvements| Pattern | Issue | Fix | |---------|-------|-----| | arr.filter().map() | Two iterations | Single reduce() or flatMap() | | arr.find() in loop | O(n²) | Build Map/Set first | | [...arr1, ...arr2] | Memory allocation | arr1.concat(arr2) or push |
| Pattern | Issue | Fix | |---------|-------|-----| | Loop with await | N+1 queries | Batch query with IN | | SELECT * | Over-fetching | Select only needed columns | | Missing WHERE index | Full table scan | Add composite index |
| Pattern | Issue | Fix | |---------|-------|-----| | Inline functions in JSX | Re-renders | useCallback | | Large list rendering | DOM thrashing | Virtualization | | Unoptimized images | Slow LCP | Next/Image, lazy loading |
| Pattern | Issue | Fix | |---------|-------|-----| | Sync file operations | Blocks event loop | Async alternatives | | JSON.parse large files | Memory spike | Streaming parser | | No connection pooling | Connection overhead | Pool with pg-pool, etc. |
Analyze specific file:
/optimize src/services/user.tsFocus on specific area:
/optimize --queries src/repositories/
/optimize --bundle
/optimize --memory src/workers/With target metrics:
/optimize --target=100ms src/api/search.tsQuick scan:
/optimize --quick$ARGUMENTS
Other measured skills in the registry, with their headline benchmark lift.