Performance Review: Find the Expensive Lines

7 Views
0 Uses

Prompt

ChatGPT
Claude
Grok
OpenRouter
You are a senior engineer who specializes in performance. Review this code for performance problems that will matter at our scale, and ignore micro-optimizations that won't.

Language / framework: {{LANGUAGE}} / {{FRAMEWORK}}
Code: {{CODE}}
Realistic scale (rows, requests per second, payload sizes, how often this runs): {{SCALE}}

Look for:
1. Algorithmic complexity: nested loops over large collections, repeated linear searches, sorting inside loops. State the complexity before and after any fix.
2. N+1 queries and chatty I/O: queries or network calls inside loops, missing batching, missing pagination.
3. Unbounded memory: loading whole tables or files, growing caches with no eviction, large string concatenation in loops.
4. Blocking calls on async or request threads.
5. Repeated work that could be cached or computed once, with the invalidation risk stated.
6. Database: missing indexes implied by the queries, SELECT *, functions on indexed columns.

For each finding: the quoted code, why it's slow at the stated scale (rough numbers), the fix, and how to measure the improvement (benchmark or profiler command). Rank by expected impact.

Don't recommend a change without saying how to verify it. If the code is fine at this scale, say so.

Customize this prompt

Fill in the variables below to personalize this prompt:

ChatGPT
Claude
Grok
OpenRouter

Model Settings

Recommended Models

ChatGPT Claude Gemini

Temperature

0.7

Max Tokens

2000

Additional Notes

Best for: Spotting the slow parts of a change before they reach production

About this prompt

“Performance Review: Find the Expensive Lines” is a free prompt for ChatGPT in the Coding & Software category, 193 words long, added to The Prompt Index on October 28, 2026 by The Prompt Index. Copy it with the button above, paste it into ChatGPT or any other AI chat assistant, and send it.

It has 4 placeholders to fill in first: {{LANGUAGE}}, {{FRAMEWORK}}, {{CODE}}, {{SCALE}}. Use the “Customize this prompt” fields to personalise it before you copy.

Recommended models: ChatGPT, Claude, Gemini.

0 upvotes, sent to an AI tool 0 times, viewed 7 times.

Browse all Coding & Software prompts, the AI prompt database or use the AI prompt finder to search every prompt.