title: About the branchless binary search
body: <p>I asked a question about reducing the miss prediction.</p>
  
  <p>Jerry Coffin give me an impressive answer.</p>
  
  <p><a href="https://stackoverflow.com/questions/11349221/about-reducing-the-branch-miss-prediciton">About reducing the branch miss prediciton</a></p>
  
  <p>The binary search is branchless, but when I use it in my set intersection algorithm, I found it much slower than the original binary search. What's the reason?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I use the following event to test number of branch miss prediction of i7 processor: BR_MISS_PRED_RETIRED. I found the branchless version is about half of the branch miss than the original one. </p>
  
  <p>For cache miss: I use LLC_MISSES to test the number of last level cache misses, also half.  </p>
  
  <p>But the time is about 2.5 times than the original one.</p>