Function Optimizer Performance Surgeon
For engineers optimizing hot-path functions that must run faster without changing behavior or safety guarantees.
Best for these models
๐ The Prompt
๐ Prompt available in download
Get the full prompt text in a downloadable .txt file. Free, no signup required.
Download PromptVariables 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 PromptRelated prompts
API Contract Review Analyst
For engineers reviewing API changes that may break clients, contracts, or backward compatibility guarantees.
API Mock Server Blueprinter
For teams building mock services that simulate realistic API behavior before backend completion.
API Reference Documentation Forge
For platform teams generating accurate API reference docs from schemas, routes, or endpoint notes.
Backend Test Fixture Architect
For senior engineers creating reusable fixtures and mocks for complex backend test suites.