Hacker News new | ask | show | jobs
by frankchn 19 days ago
Won't that just stall the pipeline on a modern superscalar core and cause even worse performance?
3 comments

Yes. I don’t think this person (presumed) knows what a branch predictor does.
There are use cases where branch prediction performs better and others where it performs worse. Ask an AI about branchless programming and when it can improve performance. We need both types of CPU instructions to achieve optimal performance.
A misprediction may be much worse than a small stall.

Your error is to assume that it has to be only one or the other, instead of giving the programmer the choice, since the programmer is the only one benchmarking his code and knowing the answer.