---
name: performance-optimization-c2531574948c
description: >
  Measure, identify bottlenecks, fix, verify, and guard performance regressions.
  Use for web vitals, slow APIs, heavy notebooks/pipelines, or video/render workloads.
  Triggers: "performance", "optimize", "slow", "latency", "bundle size", "profiling".
---

# Performance optimization

## Workflow

```
MEASURE -> IDENTIFY -> FIX -> VERIFY -> GUARD
```

Never optimize without a baseline.

## Measure first

| Domain | Signals |
|--------|---------|
| Web | LCP, INP, CLS, bundle size, waterfall |
| API/DB | p50/p95 latency, query plans, N+1 |
| Data/ML | wall time, memory peak, I/O wait |
| Media | frame time, encode throughput |

## Identify

- Profile before guessing (browser Performance, py-spy, query EXPLAIN)
- One bottleneck at a time; document hypothesis

## Fix patterns (common)

| Issue | Direction |
|-------|-----------|
| Large JS bundle | Code split, lazy routes, tree-shake |
| Render churn | Memoization only when measured; virtualize lists |
| Slow queries | Indexes, fewer round trips, pagination |
| Pandas hot path | Vectorize, polars, smaller dtypes |

## Verify

- Compare before/after with same workload
- Check regressions on adjacent metrics (memory, error rate)

## Guard

- Budget thresholds in CI or release checklist
- `gstack/benchmark` for web regressions when applicable

## Related

`gstack/benchmark`, `frontend-engineering/frontend-ui-accessibility`, `observability-slo`

See [reference.md](reference.md) for a performance review checklist.


---
Source attribution: charlieviettq
Original project: https://github.com/charlieviettq/awesome-agent-skill/blob/c567ae426d55fa498e919fc0f5a37c582d5c7a2c/.cursor/skills/performance/performance-optimization/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Dave AI.

## Upstream license notice

MIT License

Copyright (c) 2026 charlieviettq

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Dave AI resource metadata

Creator / publisher: charlieviettq
Original project: https://github.com/charlieviettq/awesome-agent-skill/blob/c567ae426d55fa498e919fc0f5a37c582d5c7a2c/.cursor/skills/performance/performance-optimization/SKILL.md
Attribution basis: Source repository record

Fields of work: Development & Engineering
Roles: Frontend Developer, Backend Developer, Data Engineer, ML / AI Engineer, QA / Test Engineer
Specialties: Frontend, Backend, Testing, Cross Platform
Tools: Tool not specified
Country applicability: Country not specified
Classification basis: Source category, role and specialization labels
Instruction SHA-256: d236aa71a25990f312000c35641b298dfc2e3672778b3265eeac5c21274fdbe2
