You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The cold attribute exists for functions, but one might want to put weights on branches. This could have 3 forms; weight=N where N is 0-1, likely (1) and unlikely (0).
LLVM understands these annotations on branches already and can use these to fine-tune assembly to reduce branch mis-predictions. By nature, these could be used extensively in the standard library.
ie
match leaf {
#[likely]
Some(x) => recurse(x),
None => {
// do stuff that doesn't make sense to be in a cold fn
...
}
}
There have been cases in Haskell libraries where changing the order of ADTs can increase performance by around 20% because branches are guessed differently by the compiler.
The text was updated successfully, but these errors were encountered:
The
cold
attribute exists for functions, but one might want to put weights on branches. This could have 3 forms;weight=N
where N is 0-1,likely
(1) andunlikely
(0).LLVM understands these annotations on branches already and can use these to fine-tune assembly to reduce branch mis-predictions. By nature, these could be used extensively in the standard library.
ie
There have been cases in Haskell libraries where changing the order of ADTs can increase performance by around 20% because branches are guessed differently by the compiler.
The text was updated successfully, but these errors were encountered: