Design Follows Data Structures
11 hours ago
- #performance optimization
- #object-oriented programming
- #data structures
- Performance optimization has shifted from CPU instruction optimization to focusing on cache efficiency due to larger data sets and faster CPUs.
- Compilers optimize code but struggle with data structure optimization because data representation is a system boundary they can't cross.
- Object-oriented programming (OOP) was thought to help with data structure changes through encapsulation, but in practice, it often doesn't facilitate performance-related changes.
- Aggregate data transformations, like 'struct of arrays' vs 'array of structs', can significantly improve performance but are antithetical to OOP principles.
- The most effective way to make invasive data representation changes is to use a language with a strong type system, make breaking changes, and fix all compiler errors directly.
- Limiting dependencies and not leaking data representation into system boundaries are key strategies for managing data structure changes.