4 ms·
Using likely () and unlikely ()
- kstenerud 14y agoAside from this contrived nuclear meltdown example (which could be more efficiently handled using interrupts rather than polling), when would you ever encounter a situation where a few nanoseconds/picoseconds would make enough of a difference that you want to force a pipeline hit on the unlikely code path and a pipeline miss on the likely path? And really, considering how rare (and implausible) such situations are, why not just put a comment in the code to communicate your intent to maintenance engineers? Rejiggering the 99.999% case to accomodate the 0.001% case is a major cause of unnecessary complexity.