Yes, you are right of course. But it is not really a contest. And if
you could improve algorithm or implementation on "your Python version
running under your OS on your hardware" it may as well improve
performance for other people under other OS's.
On Sep 2, 3:14 pm, Terry Reedy wrote:
> On 9/1/
On 9/1/2010 9:08 PM, Dmitry Chichkov wrote:
Given: a large list (10,000,000) of floating point numbers;
Task: fastest python code that finds k (small, e.g. 10) smallest
items, preferably with item indexes;
Limitations: in python, using only standard libraries (numpy& scipy
is Ok);
I've tried se
By the way, improving n-ARG-smallest (that returns indexes as well as
values) is actually more desirable than just regular n-smallest:
== Result ==
1.38639092445 nargsmallest
3.1569879055 nargsmallest_numpy_argsort
1.29344892502 nargsmallest_numpy_argmin
Note that numpy array constructor eats aro
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):
> >
Arnaud Delobelle wrote:
> I get:
>
> 1.46s for _heapq.nsmallest
> 0.85s for nsmallest_slott_bisect2 (version I posted)
>
> I am a bit surprised that mine is so slow compared with yours. I'll
> do more tests later!
Strange. I see a significant difference only for python3 (on 64bit Linux)
$ pyt
On Sep 2, 7:59 am, Peter Otten <__pete...@web.de> wrote:
> Dmitry Chichkov wrote:
> > Given: a large list (10,000,000) of floating point numbers;
> > Task: fastest python code that finds k (small, e.g. 10) smallest
> > items, preferably with item indexes;
> > Limitations: in python, using only stan
Dmitry Chichkov wrote:
> Code:
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 en
Dmitry Chichkov wrote:
> Given: a large list (10,000,000) of floating point numbers;
> Task: fastest python code that finds k (small, e.g. 10) smallest
> items, preferably with item indexes;
> Limitations: in python, using only standard libraries (numpy & scipy
> is Ok);
>
> I've tried several me
Dmitry Chichkov writes:
> Given: a large list (10,000,000) of floating point numbers;
> Task: fastest python code that finds k (small, e.g. 10) smallest
> items, preferably with item indexes;
> Limitations: in python, using only standard libraries (numpy & scipy
> is Ok);
>
> I've tried several m
Given: a large list (10,000,000) of floating point numbers;
Task: fastest python code that finds k (small, e.g. 10) smallest
items, preferably with item indexes;
Limitations: in python, using only standard libraries (numpy & scipy
is Ok);
I've tried several methods. With N = 10,000,000, K = 10 The
10 matches
Mail list logo