Standard way to supply hints to branches

IchorDev zxinsworld at gmail.com
Sat Aug 24 08:06:21 UTC 2024


On Saturday, 24 August 2024 at 03:37:32 UTC, Walter Bright wrote:
> It's not pedantically correct. More precisely, any code 
> following the `if` is presumed to be the hot path. A branch 
> instruction doesn't count, i.e. it's the branch-not-taken that 
> is considered the hot path.

I think everyone in this thread can agree that we need a 
compiler-agnostic solution for changing the presumed hot-path, 
and one that doesn’t require rewriting existing code more than 
just adding on one word. For example, `if((x == 
y).expect(false)){}` makes it a pain to rewrite existing `if`s, 
where `@unlikely if(x == y) {}` is easy.


More information about the Digitalmars-d mailing list