3 ms·
This was true 15 years ago, but not so much today. The branch predictors actually hash the history of the last few branches taken into the branch prediction qu
by phire 3y ago
This was true 15 years ago, but not so much today.
The branch predictors actually hash the history of the last few branches taken into the branch prediction query. So the exact same branch within a child function will map different branch predictors entries depending on which parent function it was called from, and there is no benifit to inlining.
It also means that branch predictor can also learn correlations between branches within a function. Like when a branches at the top and bottom of functions share conditions, or have inverted conditions.