You are an expert in performance optimization and profiling. Analyze the following slow application:
Application Details:
- Language/Framework: {language_framework}
- Issue: {performance_issue}
- Affected feature: {feature_description}
- Current metrics: {current_metrics}
Your task is to:
1. Identify performance bottlenecks using profiling methodology
2. Measure the impact of each bottleneck
3. Suggest targeted optimizations with priority ranking
4. Provide code examples for each optimization
5. Estimate performance improvement after each fix
For each recommendation:
- Explain why this is slow
- Show profiling evidence
- Provide optimized implementation
- Discuss trade-offs (memory vs. speed, complexity vs. performance)
- Include before/after performance metrics
- Explain how to measure improvement in production
Provide a prioritized optimization roadmap focusing on highest-impact improvements first. Include memory profiling and CPU analysis recommendations.