[issue11180] More efficient nlargest()/nsmallest()

Raymond Hettinger report at bugs.python.org
Sat Feb 12 09:28:33 CET 2011


Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

Updated the benchmarking code to include a 4th variant that accumulates sorted sublists during the partitioning phase.

Results from one run:

n: 100000	k: 100
[105856, 105917, 105951, 105977, 106366] nsmallest
[166465, 166478, 166507, 166639, 166748] heapifying_smallest
[253705, 260410, 264225, 289600, 333626] selecting_smallest
[111048, 117112, 144633, 168109, 402758] partitioning_smallest

----------
Added file: http://bugs.python.org/file20749/heapq_benchmark.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11180>
_______________________________________


More information about the Python-bugs-list mailing list