Branching on secret values makes control flow depend on private data. Different paths can take measurably different times, allowing timing attacks to recover secrets through side-channel analysis—even without physical probes. section 10.5
Modern processors predict branch directions to keep their pipelines full. Wrong predictions flush pipelines and caches, so speculative execution can preserve timing differences that reveal which path depended on the secret. section 10.5
Branching versus branchless summation
A C loop sums array elements above a threshold with `if (array[i] > threshold)`. A branchless variant uses comparison and conditional-move instructions instead. On an unsorted 100-million-element array, the branchless version runs faster in the recorded test; after sorting, predictable branching runs faster. The performance difference illustrates why predictability matters and why sensitive values should not select control flow.
