▲ | marginalia_nu 10 days ago | |||||||||||||||||||||||||||||||
Yup. I've got a function the gist of which is
This looks like it could be simplified as
But if you do you lose out on 20% of performance due to branch mispredictions, and this is a very hot function. It looks like a mistake, like the two are equivalent, but they are actually not. So it gets a comment that explains what's happening. | ||||||||||||||||||||||||||||||||
▲ | brokencode 10 days ago | parent [-] | |||||||||||||||||||||||||||||||
That feels like.. something the compiler should be optimizing for you? I would certainly be among those questioning this code. | ||||||||||||||||||||||||||||||||
|