I have a class called Writer that has a function writeVector like so:
void Drawer::writeVector(vector vec, bool index=true
In the function, I'm doing the if (index) check on every round of my for-loop, even though the result is always the same. This is against "worrying about the performance".
If this is indeed the case, the branch predictor will have no problem in predicting the (constant) result. As such, this will only cause a mild overhead for mispredictions in the first few iterations. It's nothing to worry about in terms of performance
In this case I advocate for keeping the test inside the loop for clarity.