Additionally, a hard part is that all of this can change over time with new hardware! Some patterns that were crucial before everything gained branch predictors are irrelevant now, etc.
I love this saying. The general problem, optimizing the wrong metric, shows up all over the place.