<Optimization>
= unlikely / likely MACRO
They are an instruction to the compiler to emit instructions that will cause branch prediction to favour the "likely" side of a jump instruction. This can be a big win, if the prediction is correct it means that the jump instruction is basically free and will take zero cycles. On the other hand if the prediction is wrong, then it means the processor pipeline needs to be flushed and it can cost several cycles. So long as the prediction is correct most of the time, this will tend to be good for performance.
Like all such performance optimisations you should only do it after extensive profiling to ensure the code really is in a bottleneck, and probably given the micro nature, that it is being run in a tight loop. Generally the Linux developers are pretty experienced so I would imagine they would have done that. They don't really care too much about portability as they only target gcc, and they have a very close idea of the assembly they want it to generate.
'보관용' 카테고리의 다른 글
[Util] SlidingVal (0) | 2014.10.29 |
---|---|
[GDM] 전반 (0) | 2014.10.28 |
[Oops 분석] 예제 (0) | 2014.10.24 |
[Memory] All (0) | 2014.10.24 |
[ps] All (0) | 2014.10.24 |