What techniques to avoid conditional branching do you know?

前端 未结 9 511
迷失自我
迷失自我 2021-02-03 23:47

Sometimes a loop where the CPU spends most of the time has some branch prediction miss (misprediction) very often (near .5 probability.) I\'ve seen a few techniques on very isol

9条回答
  •  既然无缘
    2021-02-04 00:16

    Most processors provide branch prediction that is better than 50%. In fact, if you get a 1% improvement in branch prediction then you can probably publish a paper. There are a mountain of papers on this topic if you are interested.

    You're better off worrying about cache hits and misses.

提交回复
热议问题