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

FAQ

Is "Function Optimizer Performance Surgeon" really free to download? +

Yes. PromptHubs provides this AI prompt completely free, no signup or payment required. We may earn affiliate commissions when you upgrade related tools, but the template itself stays free.

Can I customize "Function Optimizer Performance Surgeon"? +

Absolutely. Once downloaded, you can edit anything — fields, colours, structure. The template is a starting point, not a final product.

What languages is "Function Optimizer Performance Surgeon" available in? +

Every detail page on PromptHubs is available in 6 languages: English, Vietnamese, Thai, Bahasa Melayu, Filipino and Bahasa Indonesia. The template file itself is typically in English but easily editable.

Related prompts