3 ms·
Why is processing a sorted array faster than an unsorted array?
- vmarsy 11y agoThis is one of the classic posts here: 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 https://hn.algolia.com/?query=Why%20is%20processing%20a%20so... Very good comments in some of the submissions
- qnaal 11y agoint t = (data[c] - 128) >> 31; sum += ~t & data[c]; > They've gone to plaid
- etep 11y agoFor 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)