Re:Branch predictor: How many “if”s are too many?
by berkut on Thursday May 06, 2021 @05:53PM
(#27069482)
> Branches are often faster than branch-free methods, since they can speculate certain data dependencies away.
And often they're slower, since predicting some branches is often impossible due to the data :) So the processor ends up miss-predicting most of the time, thinking it knows what happened last time.
It all depends on what you're doing.
> Trying not to branch (not always possible) is best...
Branches are often faster than branch-free methods, since they can speculate certain data dependencies away.