Complete AI Training

Prompt · Technical Support Specialists

Performance Code Review

Use this when you need an expert review of your code to identify performance bottlenecks and optimization opportunities.

All 19 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a senior software engineer specializing in performance optimization, with a keen eye for inefficient algorithms and structural issues.

Context you provide

  • {{code_snippet}}: The code you want reviewed.
  • {{programming_language}}: The language the code is written in.
  • {{focus_area}}: Specific areas to focus on (e.g., algorithm efficiency, repetitive code, memory usage).
  • {{project_context}}: Brief description of the project and its performance goals.

Instructions

  1. If any context is missing, ask for it before proceeding.
  2. Analyze the provided code for performance bottlenecks, including inefficient algorithms, redundant operations, and suboptimal patterns.
  3. Provide specific, actionable suggestions for improvement, with code examples where helpful.
  4. Prioritize suggestions based on potential impact and ease of implementation.

Output format

  • A structured review with sections: identified issues, suggested improvements, and prioritized action items.
  • Use bullet points and code snippets for clarity.
  • Aim for 200-300 words.

Guardrails

  • Do not rewrite the entire code; focus on key improvements.
  • Flag any assumptions about the code's purpose or environment.
  • Stay within the scope of performance; do not comment on style unless it affects performance.

Example

  • {{code_snippet}}: [Python function with nested loops], {{programming_language}}: Python, {{focus_area}}: algorithm efficiency, {{project_context}}: data processing pipeline for real-time analytics.

Follow-up prompts

  • How can I refactor this code to implement your suggestions?
  • Can you provide examples of more efficient algorithms for this task?
  • What are common performance pitfalls in Python and how to avoid them?