Four Kinds of Optimisation
a year ago
- #optimization
- #performance
- #programming
- Premature optimization can be harmful, but overdue optimization leads to frustration.
- Human optimism often misleads us into thinking we know where and how to optimize programs effectively.
- Rigorous profiling is essential to understand a program's performance across different scenarios.
- Four main solutions for optimization: better algorithms, better data structures, lower-level systems, and accepting less precise solutions.
- Choosing a better algorithm requires understanding context, input nature, and performance trade-offs.
- Better data structures, like sorted lists for binary search, can significantly improve performance.
- Rewriting in a lower-level language can offer speed but often at a high cost in time and complexity.
- Accepting less precise solutions, like approximations or ML outputs, can be a viable optimization strategy.
- Optimization should balance correctness, human time, and breadth of knowledge over depth in specific techniques.