Initial implementation for argpartial_sort#342
Conversation
4cb937e to
b2720c4
Compare
|
@hombit I need your help with this POC. The algorithm itself is very simple. |
Merging this PR will not alter performance
Comparing Footnotes
|
hombit
left a comment
There was a problem hiding this comment.
Looks good. It would be interesting to see performance vs np.argpartition, even for a single data point, e.g. len=100_000, k=100.
| let mut heap = BinaryHeap::new(); | ||
| heap.reserve(pos); |
There was a problem hiding this comment.
I believe we need pos + 1 here because it is what we have before we pop. It also may be simplified with the specialized constructor.
| let mut heap = BinaryHeap::new(); | |
| heap.reserve(pos); | |
| let mut heap = BinaryHeap::with_capacity(pos+1); |
a3e3ddb to
4fe18ee
Compare
|
I've implemented the benchmarks. For now it works ugly for large |
| assert_equal(expected, argpartial_sort(x, 5)) | ||
|
|
||
|
|
||
| @pytest.mark.benchmark(min_rounds=10, disable_gc=True, warmup=False) |
There was a problem hiding this comment.
Our CI doesn't support these arguments, please remove
No description provided.