

Why is processing a sorted array faster than an unsorted array? - gphilip
http://stackoverflow.com/questions/11227809/why-is-processing-a-sorted-array-faster-than-an-unsorted-array/11227902#11227902

======
vmarsy
This is one of the classic posts here:

[https://hn.algolia.com/?query=Why%20is%20processing%20a%20so...](https://hn.algolia.com/?query=Why%20is%20processing%20a%20sorted%20array%20faster%20than%20an%20unsorted%20array%3F&sort=byPopularity&prefix&page=0&dateRange=all&type=story)

Very good comments in some of the submissions

------
etep
For completeness, a) make the array very big (much much bigger than the LLC)
b) split the work amongst cores (make it parallel with your favorite
methodology)

------
qnaal

      int t = (data[c] - 128) >> 31;
      sum += ~t & data[c];
    

> They've gone to plaid

