Re: A strange statement in the bisect documentation?

2015-03-09 Thread Dmitry Chichkov
beceuse they don't expect the container to ever become large. On Friday, March 6, 2015 at 6:24:24 PM UTC-8, Steven D'Aprano wrote: > Dmitry Chichkov wrote: > > > I was looking over documentation of the bisect module and encountered the > > following very strange statemen

A strange statement in the bisect documentation?

2015-03-06 Thread Dmitry Chichkov
I was looking over documentation of the bisect module and encountered the following very strange statement there: >From https://docs.python.org/2/library/bisect.html ...it does not make sense for the bisect() functions to have key or reversed arguments because that would lead to an inefficient

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

2010-09-02 Thread Dmitry Chichkov
wrote: > On 9/1/2010 9:08 PM, Dmitry Chichkov wrote: > > > Your problem is underspecified;-). > Detailed timing comparisons are only valid for a particular Python > version running under a particular OS on particular hardware. So, to > actually run a contest, you would have to

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

2010-09-02 Thread Dmitry Chichkov
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

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

2010-09-02 Thread Dmitry Chichkov
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): > >

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

2010-09-01 Thread Dmitry Chichkov
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