Refactor Code for Better Performance

Get your code refactored for better performance with Big O analysis and design pattern suggestions.

๐Ÿ“ The Prompt

Refactor the following code to improve performance and readability. ```[LANGUAGE] [PASTE YOUR CODE HERE] ``` Please: 1. **Identify bottlenecks** โ€” What's slow and why? 2. **Optimize algorithms** โ€” Better data structures (with Big O analysis) 3. **Reduce complexity** โ€” Simplify nested logic, extract functions 4. **Apply design patterns** โ€” Where appropriate 5. **Improve naming** โ€” More descriptive names 6. **Add error handling** โ€” Where missing 7. **Before vs After** โ€” Show refactored code with comments Constraints: [ANY CONSTRAINTS]

๐Ÿ’ก Tips for Better Results

Mention performance requirements (latency, memory) for targeted optimizations.

๐ŸŽฏ Use Cases

Code reviews, performance sprints, technical debt reduction, interview prep.

๐Ÿ”— Related Prompts

๐Ÿ’ป Coding beginner

Explain Code Like Im a Beginner

Get any code explained in plain English with line-by-line breakdowns, analogies, and learning suggestions.

๐Ÿ’ป Coding beginner

Debug My Code and Explain the Fix

Get your code debugged with clear explanations of what went wrong and why, plus the corrected version.

๐Ÿ’ป Coding intermediate

Write Unit Tests for My Code

Generate thorough unit tests covering edge cases, error handling, and both positive and negative scenarios.

๐Ÿ’ป Coding intermediate

Convert Code Between Languages

Convert code between any programming languages while maintaining idiomatic patterns and best practices.

๐Ÿ’ป Coding intermediate

Write a REST API Endpoint

Generate production-ready REST API endpoints with validation, error handling, and documentation.

๐Ÿ’ป Coding advanced

Create a GitHub Actions CI/CD Workflow for Automated Testing and Deployment

Generate a complete GitHub Actions CI/CD workflow with build, test, deploy, and notification jobs for your project.