Performance Optimization Layer 2: Design Choices Core Question What's the bottleneck, and is optimization worth it? Before optimizing: - Have you measured? (Don't guess) - What's the acceptable performance? - Will optimization add complexity? --- Performance Decision → Implementation | Goal | Design Choice | Implementation | |------|---------------|----------------| | Reduce allocations | Pre-allocate, reuse | , object pools | | Improve cache | Contiguous data | , | | Parallelize | Data parallelism | , threads | | Avoid copies | Zero-copy | References, | | Reduce indirection | Inline data | ,…