Selecting k smallest or largest elements from a large list in python; (benchmarking)

Dmitry Chichkov dchichkov at gmail.com
Thu Sep 2 10:47:58 CEST 2010


Uh. I'm sorry about the confusion. Last three items are just O(N)
baselines. Python min(), Numpy argmin(), Numpy asarray().
I'll update the code. Thanks!

> A lot of the following doesn't run or returns incorrect results.
> To give but one example:
>
> > def nargsmallest_numpy_argmin(iter, k):
> >     distances = N.asarray(iter)
> >     mins = []
>
> Could you please provide an up-to-date version?
>
> Peter
>
> PS: for an easy way to ensure consistency see timeit/time_all in my previous
> post.




More information about the Python-list mailing list