In the Overview | Odin Programming Language:
A hint to the compiler that this procedure is rarely called, and thus “cold”
What does it mean? That code will be far from processor?
How it works?
In the Overview | Odin Programming Language:
A hint to the compiler that this procedure is rarely called, and thus “cold”
What does it mean? That code will be far from processor?
How it works?
I’m pretty sure it just sets the LLVM function attribute cold. The docs for that can be found here: LLVM Language Reference Manual — LLVM 23.0.0git documentation
Since it’s not much, I’ll just paste it below. In the end, it’s really just a hint for LLVM. I would guess that cold procedures are less likely to be inlined, but I actually have no idea. Should you just slap it on any proc that you don’t call often? Probably not. But you could experiment with it and see if you can measure any differences. If you find a case where it actually helps, nice!
This attribute indicates that this function is rarely called. When computing edge weights, basic blocks post-dominated by a cold function call are also considered to be cold and, thus, given a low weight.