Message78584
The wrapper around heapq.nlargest and heapq.nsmallest is much slower
than it's C version.
$ python2.5 -mtimeit -s 'import random; random.seed(123); n=999999;
x=range(n); random.shuffle(x); import _heapq' '_heapq.nlargest(3, x)'
10 loops, best of 3: 142 msec per loop
$ python2.5 -mtimeit -s 'import random; random.seed(123); n=999999;
x=range(n); random.shuffle(x); import heapq' 'heapq.nlargest(3, x)'
10 loops, best of 3: 685 msec per loop
If the key argument is None, there is no need to use the wrapper. This
patch adds an a check to avoid this. |
|
Date |
User |
Action |
Args |
2008-12-31 01:07:20 | nilton | set | recipients:
+ nilton |
2008-12-31 01:07:20 | nilton | set | messageid: <1230685640.21.0.309220494864.issue4790@psf.upfronthosting.co.za> |
2008-12-31 01:07:18 | nilton | link | issue4790 messages |
2008-12-31 01:07:17 | nilton | create | |
|