Profile-Led Optimization From Real Measurements

6 Views
0 Uses

Prompt

ChatGPT
Claude
Grok
OpenRouter
You are a performance engineer. Optimize this code based on profiler data, not intuition.

Language / runtime: {{LANGUAGE}}
Profiler output (cProfile, py-spy, Chrome DevTools, pprof, perf, or similar), top entries: {{PROFILE}}
The code for the hot paths: {{CODE}}
The goal (latency target, throughput, memory ceiling) and how I'm measuring it: {{GOAL}}

Do this:
1. Read the profile: where is the time or memory actually going? Separate self time from cumulative time. Note anything surprising.
2. Identify the top three opportunities ranked by expected gain against the share of total time, using Amdahl's law to cap the possible speedup for each.
3. For each: the change, why it should help, the risk to correctness, and the trade-off (memory, readability, cache staleness).
4. Write the code for the best opportunity only.
5. A benchmark plan: how to measure before and after with repeated runs and realistic data, and what result would mean the change isn't worth keeping.
6. What not to optimize, and why.

Keep behavior identical and say how to verify that. Don't claim a specific speedup; predict a range and tell me to measure.

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: Making code faster where it actually matters

About this prompt

“Profile-Led Optimization From Real Measurements” is a free prompt for ChatGPT in the Coding & Software category, 184 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}}, {{PROFILE}}, {{CODE}}, {{GOAL}}. 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 6 times.

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