Coding Advanced XML Structured

Function Optimizer Performance Surgeon

For engineers optimizing hot-path functions that must run faster without changing behavior or safety guarantees.

๐Ÿ’ป
Rating
4.9
Difficulty
Advanced
Format
XML Structured
Variables
4
Download Prompt FREE

Best for these models

โ— Claude Opus 4.6 โ— ChatGPT (GPT-5.4) โ— Gemini 3.1 Pro โ— GPT-5.4-mini

๐Ÿ“‹ The Prompt

XML Structured .txt

๐Ÿ”’ Prompt available in download

Get the full prompt text in a downloadable .txt file. Free, no signup required.

Download Prompt

Variables to fill in

{{FUNCTION_CODE}} โ€” Replace with your input
{{CONSTRAINTS}} โ€” Replace with your input
{{TARGET_ENV}} โ€” Replace with your input
{{KNOWN_ISSUE}} โ€” Replace with your input

About this prompt

Function Optimizer Performance Surgeon is designed for code that works but runs too slowly. It asks the model to inspect a function, identify expensive operations, and recommend improvements without changing behavior. The prompt is useful when you suspect repeated allocations, redundant loops, unnecessary I/O, or poor algorithmic choices. It encourages the model to think in terms of complexity, memory pressure, and measurable gains rather than stylistic preferences.

This template is aimed at performance engineers, backend developers, and platform teams who care about latency and throughput. It asks for a before-and-after explanation so you can understand why a change should be faster. The output focuses on time complexity, memory usage, and tradeoffs, which makes it suitable for hot paths, batch jobs, and user-facing services where milliseconds matter. It can also flag when optimization is risky because readability or correctness could suffer.

Customize it by pasting the function into {{FUNCTION_CODE}}, describing constraints in {{CONSTRAINTS}}, and noting your target runtime in {{TARGET_ENV}}. If you already know the bottleneck, set {{KNOWN_ISSUE}} so the model can go deeper instead of guessing. The result should include a performance diagnosis, a ranked list of optimizations, and a rewritten version when appropriate. Use this optimization prompt when you need speed improvements with clear reasoning and safe fallback options.

Key features

  • Performance analysis for slow functions and hot paths
  • Checks algorithmic complexity before suggesting micro-optimizations
  • Preserves behavior while reducing overhead and allocations
  • Includes tradeoff analysis for readability versus speed
  • Returns an optimized rewrite with a verification plan

Best for

  • โ†’ Backend engineers tuning latency-sensitive services
  • โ†’ Platform teams optimizing batch processing pipelines
  • โ†’ Senior developers reviewing performance regressions

Tips

  • ๐Ÿ’ก Provide real benchmark numbers if you have them, not just intuition
  • ๐Ÿ’ก Mention data sizes so the model can judge algorithmic impact accurately
  • ๐Ÿ’ก Ask for both a safe optimization and an aggressive one if needed

What you'll get

A performance report with bottleneck analysis, complexity estimates, an optimized rewrite, tradeoff notes, and a verification checklist. It helps you decide whether the speedup is worth the added complexity.

Preparing your download...

Download Prompt

Related prompts