title: Why is .sum() faster than .any() or .max()?
body: <p>When optimising slow parts of my code, I was surprised by the fact that <code>A.sum()</code> is almost twice as fast as <code>A.max()</code>:</p>
  
  <pre><code>In [1]: A = arange(10*20*30*40).reshape(10, 20, 30, 40)
  
  In [2]: %timeit A.max()
  1000 loops, best of 3: 216 us per loop
  
  In [3]: %timeit A.sum()
  10000 loops, best of 3: 119 us per loop
  
  In [4]: %timeit A.any()
  1000 loops, best of 3: 217 us per loop
  </code></pre>
  
  <p>I had expected that <code>A.any()</code> would be much faster (it should need to check only one element!), followed by <code>A.max()</code>, and that <code>A.sum()</code> would be the slowest (<code>sum()</code> needs to add numbers and update a value every time, <code>max</code> needs to compare numbers every time and update sometimes, and I thought adding should be slower than comparing).  In fact, it's the opposite.  Why?</p>