3 ms·
If you have a while-loop wrapping a switch statement, will most modern compilers put dispatch code at the end of every case, to help the branch predictor (actua
by KMag 6y ago
If you have a while-loop wrapping a switch statement, will most modern compilers put dispatch code at the end of every case, to help the branch predictor (actually, branch target buffer)? Even if modern branch target buffer entries were dependent upon the target of the previous indirect branch (in the switch statement), if any of your bytecodes go off and do some C++ virtual dispatches, it will quickly swamp any extra context the BTB logic may have.