Home/Templates/Performance Optimisation
Coding

Performance Optimisation Prompt Template

Analyse code for performance bottlenecks and provide a prioritised optimisation plan with expected impact for each change.

The Prompt

ROLE: You are a performance engineering specialist who has optimised web applications from 8-second load times to sub-second — you profile before you optimise and you measure after, because intuitions about performance are usually wrong. CONTEXT: You are analysing code or a system for performance issues. Performance problems are not all equal — a 500ms database query that runs on every page load is more important than a 50ms rendering calculation that runs once. The optimisation plan must be prioritised by impact, not by ease. TASK: Analyse the code or system description below for performance issues and produce a prioritised optimisation plan. RULES: • Every issue must be classified by type: Database, Network, CPU, Memory, or Rendering • For each issue: describe the current behaviour, estimate the performance impact (high/medium/low with reasoning), and provide the optimised solution with code • The order of recommendations must be by ROI (impact ÷ implementation effort) — highest ROI first • If a recommendation requires profiling to confirm (you can't tell from static analysis), flag it with [PROFILE FIRST: suggested profiling method] • Include at least one recommendation that requires no code change (configuration, caching, query tuning) CONSTRAINTS: All optimised code examples must be equivalent in output to the original — no behaviour

🔒

Upgrade to see the full prompt

Get unlimited access to all 215+ templates — starting at $9/month.

✦ Upgrade to Pro

Already have an account? Sign in

How to use this template

1

Copy the template

Click the copy button to grab the full prompt text.

2

Fill in the placeholders

Replace anything in [BRACKETS] with your specific details.

3

Paste into any AI tool

Works with ChatGPT, Claude, Gemini, Cursor, and more.

4

Or enhance with AI

Sign in to PromptIt and let AI tailor the prompt to your exact situation in seconds.

Why this prompt works

The ROI ordering (impact ÷ effort) is the most practical improvement over a flat list of optimisation suggestions — it ensures developers work on what matters most first. The [PROFILE FIRST] flag prevents the AI from giving confident recommendations about things it genuinely cannot know from static analysis.

Tips for best results

  • Add actual load test results or profiler output as CURRENT_METRICS — the AI will identify bottlenecks far more accurately from real data than from code alone
  • The no-code-change wins section is usually worth doing first — database connection pooling, query result caching, and HTTP response compression are frequently configured suboptimally
  • For React apps, add 'check for unnecessary re-renders using React DevTools Profiler' to the PROFILE FIRST list — it's the most common source of frontend performance issues
  • After implementing changes, re-run the prompt with the new code — the second pass often reveals second-order bottlenecks that only become visible once the primary one is fixed

More Coding templates

Code Review

Get a comprehensive AI code review covering bugs, performance issues, security vulnerabilities, best practice violations, and refactoring opportunities with specific line references.

View →

Debug an Error

Diagnose any code error with a structured breakdown: root cause analysis, step-by-step fix, and prevention strategies for the future.

View →

Explain Code Simply

Translate complex code into plain English with line-by-line explanations, real-world analogies, and edge-case analysis for any skill level.

View →
← Browse all 215 templates