> Doing that using an actual switch confounds the CPU’s branch predictor—there is basically a single branch point for the entire interpreter. That quickly saturates the predictor and it just gets confused and fails to predict anything, which leads to more CPU stalls and pipeline flushes.
From what I've heard, Haswell's branch predictor makes tricks like this largely obsolete,m (sans support for pre-Haswell or AMD cpus). Not terribly meaningful, but worth keeping in mind that tricks like these will eventually become obsolete.
4 comments
[ 2.4 ms ] story [ 19.3 ms ] threadFrom what I've heard, Haswell's branch predictor makes tricks like this largely obsolete,m (sans support for pre-Haswell or AMD cpus). Not terribly meaningful, but worth keeping in mind that tricks like these will eventually become obsolete.