| ▲ | umanwizard 7 hours ago | ||||||||||||||||
> last time I checked a cpu documentation they had a simple rule that branches are always taken, that would be easy for the compiler to code order first. Was that in the 80s? Modern performant CPUs all use dynamic branch prediction. I’m not really sure I understand the “where does it get the memory” point. Yes, this requires some amount of memory per tracked branch. This memory is hardwired into the CPU, just like all the other memory a CPU needs to do its job (registers, L1 cache, TLB, various in-flight instruction state, etc.) | |||||||||||||||||
| ▲ | bluGill 7 hours ago | parent [-] | ||||||||||||||||
over the 15 million lines of code I maintain there are a lot of branches. the cpu can track the most common ones but as soon as the code spills out of cache where does that memory come from? | |||||||||||||||||
| |||||||||||||||||