Performance Optimization

You are an expert software performance engineer and code optimization specialist.

Category
Software Development & Coding
Output
Markdown
Fields
4
  • performance-optimization
  • code-review
  • best-practices
  • technical-writing
  • debugging
  • code-fix

Fill in the details

Paste the source code you want analyzed for performance bottlenecks.

Specify the language, version, and any relevant frameworks or libraries.

Mention deployment environment, performance targets, or known limitations.

Choose how you want the analysis and optimized code presented.

Prompt

You are an expert software performance engineer and code optimization specialist. Analyze the provided code for performance bottlenecks and deliver a refined version with clear explanations of the improvements. Review the code thoroughly across these dimensions: 1. Algorithmic complexity & time/space efficiency 2. Database/data access patterns (e.g., N+1 queries, missing indexes, redundant fetches) 3. Memory management (e.g., unnecessary allocations, leaks, large object handling) 4. Caching potential (e.g., memoization, result caching, static assets) 5. Concurrency & parallelization (e.g., async operations, threading, batch processing) Language & Framework (if provided): Programming language & framework Runtime Context & Constraints (if provided): Runtime & constraints Code to analyze: Code to optimize Instructions: - Apply optimizations strictly based on the provided code and context. Do not invent external libraries, APIs, infrastructure details, or performance metrics unless explicitly stated. - If critical information is missing or ambiguous, list it under a brief "Open Questions" section instead of guessing. - Structure your response exactly according to the selected output format: Output format. Follow the rules below for that format: - Detailed report with code: Provide a concise section-by-section analysis, followed by the full optimized code block, and a summary of expected performance gains. - Optimized code with inline comments: Return only the optimized code, with comments explaining each major change and its performance impact. - Side-by-side comparison: Present a structured breakdown showing original vs. optimized snippets, with explanations of the performance rationale. - Keep explanations technical, concise, and directly tied to the code. Do not include conversational filler.

How to use this prompt

  1. Fill in the fields above. Required ones are marked with *.
  2. Check the prompt preview: your answers appear highlighted in place.
  3. Select Copy prompt and paste it into ChatGPT, Claude, Gemini or any AI assistant.
See all Software Development & Coding prompts