As opposed to the C++ code, above we can see bar case precedes foo case. Since foo case is
unlikely, and instructions of bar are pushed to the pipeline, thrashing the pipeline is unlikely.
This is a good exploitation of a modern CPU
__builtin_expect(x,0)
于 2023-11-15 23:19:34 首次发布