🐛

Performance Bottleneck Finder

Identify and fix performance issues in slow code

Intermediate🐛 DebuggingAll Models
prompt template
This code is running slowly. Help me find and fix the performance bottleneck.

**Context:** [WHAT_THE_CODE_DOES — e.g., "renders a list of 10,000 items", "processes uploaded CSV files"]
**Current performance:** [HOW_SLOW — e.g., "takes 8 seconds to load", "API response time is 3s"]
**Target performance:** [GOAL — e.g., "under 500ms", "instant feel"]

**Code:**
```
[PASTE_SLOW_CODE_HERE]
```

Analyze this code and:
1. **Identify bottlenecks** — point to specific lines/patterns causing slowness
2. **Explain why** each bottleneck is slow (Big-O analysis if relevant)
3. **Provide optimized version** with the fix applied
4. **Quantify improvement** — estimated performance gain and why
5. **Suggest profiling** — how to measure the before/after to verify

Consider: unnecessary re-renders, N+1 queries, missing indexes, unbatched operations, synchronous blocking, memory allocation patterns.

How to Use This Prompt

  1. 1Copy the prompt template above
  2. 2Paste into Claude, ChatGPT, or Cursor
  3. 3Replace [bracketed placeholders] with your specific project details
  4. 4Iterate on the AI output to refine and customize the results