This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jtaylor
Recipients alex, ezio.melotti, jtaylor, scoder, steven.daprano, terry.reedy, thomasahle, tim.peters, vajrasky
Date 2014-06-07.13:02:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1402146172.66.0.81695306967.issue21592@psf.upfronthosting.co.za>
In-reply-to
Content
for median alone a multiselect is probably overkill (thats why I mentioned the minimum trick)

but a selection algorithm is useful on its own for all of python and then a multiselect should be considered.
Of course that means it would need to be implemented in C like sorted() so you actually have a significant performance gain that makes adding a new python function worthwhile.

Also just to save numpys honor, you are benchmarking python list -> numpy array conversion and not the actual selection in your script with the numpy comparison. The conversion is significantly slower than the selection itself. Also select2b is inplace while np.partition is out of place. Repeated inplace selection typically gets faster as the number of required swaps goes down and can even be constant in time if the requested value does not change.
With that fixed numpy outperforms pypy by about a factor 2 (but pypys performance is indeed quite impressive as it is far more generic)
History
Date User Action Args
2014-06-07 13:02:52jtaylorsetrecipients: + jtaylor, tim.peters, terry.reedy, scoder, ezio.melotti, steven.daprano, alex, thomasahle, vajrasky
2014-06-07 13:02:52jtaylorsetmessageid: <1402146172.66.0.81695306967.issue21592@psf.upfronthosting.co.za>
2014-06-07 13:02:52jtaylorlinkissue21592 messages
2014-06-07 13:02:52jtaylorcreate