Optimizing Code The Optimization Hat When optimizing, you improve performance without changing behavior . Always measure before and after. Golden Rules 1. Measure First : Never optimize without a benchmark 2. Profile Before Guessing : Find the actual bottleneck 3. Optimize the Right Thing : Focus on the critical path 4. Measure After : Verify the optimization worked Workflows - [ ] Benchmark : Establish baseline performance metrics - [ ] Profile : Identify the actual bottleneck - [ ] Hypothesize : What optimization will help? - [ ] Implement : Make the change - [ ] Measure : Verify improvemen…