News for hackers. Stuff that matters.
Re:Forcing code out of line in GCC and C++11 by cornstalks on Sunday January 18, 2015 @01:17AM (#8906856)
It's similar, but the whole point of the trick here is to move the generated code so it doesn't "pollute" the instruction cache in the CPU. __builtin_expect still puts the error-handling instructions right next to the rest of the code. The lambda puts the error-handling instructions elsewhere.

Whether or not this will impact performance depends, and will need some careful profiling. But I can imagine some situations where keeping the "hot" instructions in the cache and the "cold" (error-handling) instructions out of the cache could be beneficial.

Re:Forcing code out of line in GCC and C++11 by rlpb on Monday January 19, 2015 @10:10AM (#8912197)
> __builtin_expect still puts the error-handling instructions right next to the rest of the code. The lambda puts the error-handling instructions elsewhere.

Surely that's a decision for the optimizer to make, in the case of __builtin_expect?