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 changes, only performance improvements. Language: [LANGUAGE_FRAMEWORK]. EDITABLE VARIABLES: • [CODE_OR_SYSTEM] — the code or system description to optimise • [LANGUAGE_FRAMEWORK] — e.g. React/Next.js, Python/Django, Node.js/Express • [PERFORMANCE_GOAL] — specific target (e.g. "page load under 2 seconds", "API response under 200ms at P95") • [CURRENT_METRICS] — any existing performance measurements (optional but helpful) OUTPUT FORMAT: **Performance Summary:** [Current state + worst bottlenecks in 2 sentences] **Optimisation Plan (ordered by ROI):** **1. [Issue name]** [Type: DB/Network/CPU/Memory/Rendering] - Current: [What's happening now] - Impact: [High/Medium/Low + why] - Fix: [Solution with code example] - Expected improvement: [Estimated improvement] [Repeat for all issues] **[PROFILE FIRST:]** items: [List with profiling approach] **No-Code-Change Wins:** [Configuration or infrastructure recommendations] QUALITY BAR: Implementing all High-impact recommendations from this plan should produce a measurable improvement in the stated performance goal without any regressions in functionality.

Make it specific to you

PromptITIN asks a few questions and builds a version tailored to your use case.

✦ Enhance with AI

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 PromptITIN 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 195 templates