Why is max slower than sort?
<p>I've found that <code>max</code> is slower than the <code>sort</code> function in Python 2 and 3.</p>

<p>Python 2</p>

<pre><code>$ python -m timeit -s 'import random;a=range(10000);random.shuffle(a)' 'a.sort();a[-1]'
1000 loops, best of 3: 239 usec per loop
$ python -m timeit -s 'import random;a=range(10000);random.shuffle(a)' 'max(a)'        
1000 loops, best of 3: 342 usec per loop
</code></pre>

<p>Python 3</p>

<pre><code>$ python3 -m timeit -s 'import random;a=list(range(10000));random.shuffle(a)' 'a.sort();a[-1]'
1000 loops, best of 3: 252 usec per loop
$ python3 -m timeit -s 'import random;a=list(range(10000));random.shuffle(a)' 'max(a)'
1000 loops, best of 3: 371 usec per loop
</code></pre>

<p>Why <em>is</em> <code>max</code> (<code>O(n)</code>) slower than the <code>sort</code> function (<code>O(nlogn)</code>)?</p>