Closed as not planned
Description
Status quo:
@setCold(is_cold: bool) void
Tells the optimizer that a function is rarely called.
Proposal:
@cold() void
Annotates that it is relatively uncommon for control flow to reach this point. Similar to unreachable
, but only communicates probability. It communicates a willingness to compromise performance of the cold path in order to improve performance of the hot path.
This makes #489 unnecessary. Instead of:
if (@expect(foo, true)) {
bar();
} else {
baz();
}
With this proposal:
if (foo) {
bar();
} else {
@cold();
baz();
}