On 8/3/14, 4:51 PM, Mike Farnsworth wrote:
This all seems to have a very simple solution, to use something like:
expect()

GCC for example has an intrinsic, __builtin_expect() that is used to
notify the compiler of a data constraint it can use in optimization for
branches.  Why not make something like this a first-class citizen in D
(and even expand the concept to more than just branch prediction)?

__builtin_expect is actually not that. It still generates code when the expression is false. It simply uses the static assumption to minimize jumps and maximize straight execution for the true case. -- Andrei


Reply via email to