branch misprediction
RU: branch misprediction
A branch misprediction occurs when the CPU's branch predictor guesses the wrong path, forcing the pipeline to discard all speculatively executed instructions and refetch from the correct address. On modern out-of-order processors the penalty is typically tens of cycles, degrading throughput for code with unpredictable conditional branches. Sorting data, replacing branches with arithmetic, or using branchless patterns can reduce misprediction frequency.