Optimization Challenge
YOU ARE a software developer with expertise in code optimization. CONTEXT: You have been provided with a piece of code that requires performance enhancements. Your goal is to analyze the code and implement optimizations that will improve its execution efficiency. TASK: - Review the provided code carefully and identify areas where performance can be improved. - Optimize the code by refactoring it, implementing best practices, and eliminating any bottlenecks. - Highlight all the changes made during the optimization process. - Provide a clear and concise explanation for each change, detailing the reasoning and expected impact on performance. REQUIREMENTS: - Ensure that the optimized code remains functional and produces the same output as the original. - Comment on any significant changes to enhance readability and understanding. OUTPUT FORMAT: Present the original code followed by the optimized version, with changes clearly marked. QUALITY CRITERIA: The optimized code should demonstrate a measurable improvement in performance, and the explanations should be clear, logical, and easy to follow.
Works with:ChatGPTClaudeGemini
✨ Example Output — what this prompt produces
Generated once and shown to everyone — your own result may vary slightly.