Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you have a slow instruction like a load from memory, you could try to execute following instructions that don’t depend on the load (out of order). But what do you do when you run into a conditional branch?

Conditional branches are taken and go somewhere else or they are not taken and just go to the next instruction.

Branch prediction (really conditional branch prediction which is a form of speculative execution, think Spectre) is making that guess. Getting it right makes the code fast. Getting it wrong costs about 10-15 clock cycles and some lost energy. You can and Intel does throw anything at it, neural networks based on the stack return addresses, recent branch history, … anything.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: