Refactor for readability and performance
Clean up messy code with clean-code principles, better naming, and algorithmic improvements. Shows a clear before-and-after with comments on every change.
Preview
Copy prompt
Refactor the following code to improve both readability and runtime performance: [Paste code]. Apply clean code principles — extract named functions, eliminate duplication, improve variable and function naming, and simplify complex conditionals. If any section has O(n²) or worse complexity, propose a more efficient approach. Show a clear before-and-after and annotate every meaningful change.
More
Refactoring
Prompts
