name: performance description: Optimize code thoughtfully without sacrificing readability.
Performance
Optimize code thoughtfully without sacrificing readability.
- Measure performance before optimizing - profile to find bottlenecks
- Focus optimization efforts on hot paths that execute frequently
- Consider memory vs CPU tradeoffs based on constraints
- Avoid premature optimization - clarity over micro-optimizations
- Use appropriate data structures for the access patterns
- Minimize I/O operations and database queries
- Cache expensive computations when appropriate
- Use lazy loading for large resources
- Document performance-critical sections and their constraints
- Benchmark improvements to verify they actually help