I’m not usually a fan of prescriptive rules but I agree all of Rob Pike’s 5 Rules of Programming especially this one:
Rule 2. Measure. Don’t tune for speed until you’ve measured, and even then don’t unless one part of the code overwhelms the rest.
It’s very easy to wasted time on optimisation blindly.