Cursor CommandsCursor Commands
CategoriesExamples

Optimize Code for Performance

Analyzes code for performance bottlenecks, suggests improvements, and provides optimized code with explanations and performance impact estimates.

Command Code

# Optimize Performance

Analyze the current code for performance bottlenecks and provide optimization
recommendations. Focus on:

## Performance Analysis

- Identify slow algorithms and inefficient data structures
- Find memory leaks and excessive allocations
- Detect unnecessary computations and redundant operations
- Analyze database queries and API calls

## Optimization Strategies

- Suggest algorithm improvements and better data structures
- Recommend caching strategies where appropriate
- Propose lazy loading and pagination solutions
- Identify opportunities for parallel processing

## Implementation

- Provide optimized code with explanations
- Include performance impact estimates
- Suggest profiling and monitoring approaches
- Consider trade-offs between performance and maintainability

Focus on measurable improvements while maintaining code quality and readability.