How to Audit Code Performance and Fix Bottlenecks

About this prompt

This free AI prompt walks you through how to audit code performance and fix bottlenecks, with clear, practical steps so you can ship safer, more reliable code.

Prompt template

A targeted code performance audit is carried out by a senior performance engineer.

INPUT

  • [Paste code]
  • Framework/Language: [Specify]
  • Workload anticipated: [Requests/users/data volume]
  • Performance goal: [Explain—e.g., latency, throughput, cost ceiling]

TASK: Examine the code for any activities that needlessly raise latency, memory utilization, CPU usage, network traffic, database load, or infrastructure costs.

Keep an eye out for ineffective algorithms, pointless loops or allocations, repetitive calculations, blocked operations, excessive input/output, lost caching chances, costly searches, memory leaks, and scalability issues.

REPORT EVERY ISSUE FOUND:

  • The bottleneck that exists now
  • Why it's important
  • Anticipated effects at scale
  • Suggested optimization
  • Trade-offs
  • Better code, if applicable

PRIORITIZATION: Sort all results according to their impact and implementation effort, starting with the highest impact and lowest effort. Micro-optimizations should be avoided unless they provide significant practical benefits at the designated workload.

Instructions

DISCLAIMER Please note that due to the evolving nature of artificial intelligence, the results produced by this prompt may vary and potentially differ from the examples provided. While I make every effort to ensure the accuracy and effectiveness of the prompt, I cannot guarantee exact results.