Complexity of comparison operators

This question already has an answer here:

  • Why is it faster to process a sorted array than an unsorted array? 21 answers

  • One explanation is that there are less jumps if the first condition applies,

    The second explanation regards branch predication, basically, where it could 'guess' the '<' result and apply the next code regardless of the result, and muck it on failure, so when you have the same condition happening relatively a lot, the compiler can guess it correctly more often. You can read more about it here: http://en.wikipedia.org/wiki/Branch_predication

    链接地址: http://www.djcxy.com/p/5372.html

    上一篇: 什么是“缓存”

    下一篇: 比较运算符的复杂性