Optimize a Slow Function With Specific Tradeoffs
Get a ranked list of optimizations with complexity analysis and explicit tradeoffs.
§ The Prompt— ready to copy
optimize-slow-function.prompt
This function is too slow at [INPUT SIZE]. Code: [PASTE CODE] Analyze: (1) current time and space complexity, (2) the bottleneck operation, (3) 2-3 optimization approaches ranked by impact, (4) for each, the new complexity and what you're trading off (memory, code clarity, edge case handling), (5) which I should pick given my constraint: [LATENCY/MEMORY/READABILITY].
Replace anything in [BRACKETS] with your specifics before sending.
Best For — Roles
Use For — Tasks
§ Related Entries
You may also need
№ 002coding
Perform a Thorough Code Review on a Pull Request
Get a senior-engineer-style code review with categorized, file-referenced feedback.
For
claude·chatgpt
№ 021coding
Refactor Code for Readability and Maintainability
Refactor any code for readability and maintainability without changing its behavior.
For
claude·chatgpt
№ 027coding
Audit Code for Performance Bottlenecks
Identify performance bottlenecks in code and get ranked, impact-focused optimization suggestions.
For
claude·chatgpt
№ 028coding
Run a Security Review on Code
Get an OWASP-aligned security review with severity ratings and remediation snippets.
For
claude·chatgpt