Donald Knuth emphasized that developers often waste enormous time thinking about the speed of non-critical parts of their programs.
Best Practice
- Write correct, readable code first
- Profile and identify actual bottlenecks with tools (not intuition)
- Optimize only the hot paths that profiling reveals
- Re-measure to confirm your optimization actually helped
Intuition about performance is frequently wrong. Let data drive your optimization decisions.