Skip to content
Skills Library
Programming · Analysis

performance-expert

/performance-expert

Expert performance optimization across CPU, memory, I/O, and rendering. Trigger keywords: performance, slow, profiling, profiler, optimize, latency, throughput, p99, memory leak, allocation, bottleneck, benchmark, flamegraph, N+1, cache. Use to diagnose and fix performance problems with a measure-first methodology.

Licence
MIT
Last repository change
31.05.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 31.05.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Expert performance optimization across CPU, memory, I/O, and rendering. Trigger keywords: performance, slow, profiling, profiler, optimize, latency, throughput, p99, memory leak, allocation, bottleneck, benchmark, flamegraph, N+1, cache. Use to diagnose and fix performance problems with a measure-first methodology.

Original author description

Expert performance optimization across CPU, memory, I/O, and rendering. Trigger keywords: performance, slow, profiling, profiler, optimize, latency, throughput, p99, memory leak, allocation, bottleneck, benchmark, flamegraph, N+1, cache. Use to diagnose and fix performance problems with a measure-first methodology.

How it works

  1. When to Use
  2. When NOT to Use
  3. Core Principles
  4. Tools
  5. Common Mistakes
  6. Examples
  7. See Also
Original SKILL.md headings · 77 lines, 580 words
SKILL.md preview
---
name: performance-expert
description: "Expert performance optimization across CPU, memory, I/O, and rendering. Trigger keywords: performance, slow, profiling, profiler, optimize, latency, throughput, p99, memory leak, allocation, bottleneck, benchmark, flamegraph, N+1, cache. Use to diagnose and fix performance problems with a measure-first methodology."
---

# Performance Optimization Expert

> Measure, don't guess. Profile to find the real bottleneck, fix the biggest one, re-measure, repeat — and stop at the target. Algorithmic and I/O wins dwarf micro-optimizations.

## When to Use
- Something is slow, memory-hungry, or doesn't scale.
- Profiling guidance for CPU, memory, I/O, or rendering.
- Setting/validating latency or throughput targets; benchmarking.
- Hunting a memory leak or GC pressure.

## When NOT to Use
- Wrong output, not slow → `debugging-expert`.
- Behavior-preserving cleanup with no perf goal → `refactoring-expert`.
- DB query plans/indexing specifically → `sql-expert`.

## Core Principles

### 1. Measure first, always
- Profile before changing anything. Intuition about hotspots is usually wrong. Optimize the **top** item the profiler shows, not what you assume.
- Define the metric and target up front (p99 latency, throughput, peak memory, frame time) and a **representative workload** to measure against. Optimizing the wrong workload wastes effort.
- Beware micro-benchmarks that don't reflect production (warmup, caching, JIT, data size).

### 2. Biggest levers first
- **Algorithmic complexity**: O(n²)→O(n log n), removing redundant passes, and killing **N+1** calls beat constant-factor tuning by orders of magnitude.
- **Eliminate repeated work**: cache/memoize pure results, precompute, hoist invariants out of loops, batch requests.
- Apply **Amdahl's law**: speeding up code that's 5% of runtime caps your win at 5%.

### 3. Levers by axis
- **I/O-bound**: batch + parallelize requests, add caching, cut round trips, stream instead of buffering, connection pooling.
- **CPU-bound**: better algorithm/data structures, reduce allocations in hot loops, vectorize/parallelize, avoid needless serialization.
- **Memory**: stream large data, fix leaks (lingering refs, unbounded caches, dangling listeners), right-size buffers, reduce per-object overhead.
- **Frontend**: shrink/split bundles, lazy-load, virtualize long lists, avoid layout thrash and unnecessary re-renders, debounce, use the browser cache/CDN.

### 4. Verify and guard
- Re-measure after each change to confirm a **real** win and watch for regressions elsewhere. Stop when you hit the target — over-optimizing adds complexity for no user benefit. Add a benchmark/regression check to prevent backsliding.

## Tools
| Domain | Tools |
|--------|-------|
| Python | `cProfile`, `py-spy`, `memray`, `scalene` |
| Node/Web | Chrome DevTools, `--prof`, `clinic`, Lighthouse, React Profiler |
| Go | `pprof`, `go test -bench`, `-benchmem` |
| Rust/native | `perf`, flamegraphs, `cargo bench`, valgrind/heaptrack |
| DB | `EXPLAIN ANALYZE` (→ `sql-expert`) |

## Common Mistakes
- **Optimizing without profiling** → effort on cold code; ignore the real hotspot.
- **Micro-optimizing** (loop unrolling) while an N+1 or O(n²) dominates.
- **No baseline/target** → can't tell if a change helped or when to stop.
- **Premature optimization** that obscures code before there's a measured problem.
- **Caching without invalidation** → correctness bugs; cache deliberately.
- **Benchmarking unrealistic data** → wins that vanish in production.
- **Fixing a symptom in one layer** while the cost is elsewhere (e.g., app loop vs DB).

## Examples

**Profile, then fix the top frame**
```bash
python -m cProfile -s tottime app.py | head -20   # find the real hotspot
py-spy top --pid <PID>                            # sample a running process
```

**Kill an N+1 with batching**
```python
# ❌ one query per id
users = [db.get_user(i) for i in ids]
# ✅ one query
users = db.get_users_in(ids)        # WHERE id IN (...)
```

## See Also
- `debugging-expert` — same evidence-driven mindset, for correctness.
- `sql-expert` — query plans and indexing (often the real bottleneck).
- `rust-expert` / `go-expert` — low-level profiling and allocation control.
- `react-expert` — render performance and memoization.

Versions

RepositoryScoreLicence
This page · miaoge-ge/coding-agent-skills100MIT
personamanagmentlayer/pcl100Apache-2.0

Database snapshot: 13.11.2026 · package version d9bfeffe2678 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100rs-performance
    CRITICAL: Use for performance optimization. Triggers: performance, optimization, benchmark, profiling, flamegraph, criterion, slow, fast, allocation, cache, SIMD, make it faster
  • 100performance-review
    Performance optimization analysis: CPU/memory profiling, caching strategies, database query optimization, connection pooling, concurrency patterns, memory leak detection, and throughput improvement. Use when code is slow, memory usage is high, latency needs reduction, or…
  • 90Optimization
    Measure-first performance optimization playbook — profiling discipline, bottleneck triage (CPU/memory/I/O), caching layers, and the algorithm/DB/frontend/network fix patterns. Use when the user reports something is slow ("dashboard takes forever", "API is laggy", "bundle is…
  • 100performance-profiler
    Profile and optimize application performance including load times, memory usage, and rendering. Use when debugging slow performance, memory leaks, or optimizing app speed.
  • 100performance-profiling
    Finds and fixes backend and application performance problems by measuring first - define the target metric, reproduce under realistic load, profile CPU, memory, I/O and locks, fix the biggest bottleneck, re-measure, and add a regression guard. Use when code or a service is slow,…
  • 100performance-profiling
    Use when something is slow, memory-hungry or contended and the cause is not yet established - a latency or throughput target is missed, a benchmark regressed, a service grows in memory, or someone proposes an optimization that has not been measured. Triggers on "profile this",…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.