Quickly tested (on java version 1.8.0_05):
long start = System.nanoTime();
int run = 1_000_000;
for(int i = 0; i < run; ++i) {
if(alwaysTrue) {
}
}
long end = System.nanoTime();
end - start
averages ~1,820,000 nano seconds.
this:
long start = System.nanoTime();
int run = 1_000_000;
for(int i = 0; i < run; ++i) {
// if(alwaysTrue) {
//
// }
}
long end = System.nanoTime();
end - start
averages ~1,556,000 nano seconds.
as an added bonus:
long start = System.nanoTime();
int run = 1_000_000;
for(int i = 0; i < run; ++i) {
if(true) {
}
}
long end = System.nanoTime();
end - start
averages ~1,542,000 nano seconds, same as commented out.
Conclusion
if(someBool){}
inside a loop has some performance impact. But it's so negligible I find it hard to think of a bottleneck sensitive enough for it to matter.