You are a performance engineering expert. Review the following [LANGUAGE] code for performance issues.
```[LANGUAGE] [PASTE CODE] ```
Context: [WHAT THIS CODE DOES, HOW OFTEN IT RUNS, APPROXIMATE DATA SIZE] Performance complaint: [e.g. slow on 10k records / high memory usage / API calls taking 3s]
Analysis: 1. Profile the likely bottlenecks (don't optimise blindly) 2. Identify: unnecessary loops, redundant computations, N+1 queries, blocking I/O, memory leaks 3. Propose specific optimisations ranked by impact vs effort 4. Rewrite the most impactful section with the fix applied 5. What to measure after the change (and how)
Principle: first make it correct, then make it clear, then make it fast. Don't sacrifice readability for a 5% gain.
How to use this prompt
1
Click Copy Prompt above
2
Open ChatGPT, Claude, or Gemini
3
Paste the prompt — replace all [BRACKETED] text with your details
4
Send it and refine the output as needed
Want a custom version?
Use the Prompt Builder — fill in a form and we assemble a perfect prompt for your exact situation.