Cloudflare has a really interesting blog post about branch prediction and the
if jumps in code. If it’s C, I’m unsure why you’d have non-macro debug
blocks peppered throughout your code, but sometimes it could make sense.
The blog post investigates branch prediciton and how the [Branch Target Buffer] affects performance. The TLDR is that once you go above the L1 instruction cache you will find some cost, but in general the cost of an if statement that’s never taken is little to nothing, and the cost of always-taken branches may be an issue.