Crate out

source ·
Expand description

Provides functionality to get n items from a &mut [T].

This library can provide significant performance increase compared to sorting the whole list when n is relatively small.

N = 100, LEN = 1_000_000, RANGE = 1_000_000:
test binary_heap   ... bench:   6,706,060 ns/iter (+/- 102,080)
test max           ... bench:     846,891 ns/iter (+/- 19,960)
test max_unstable  ... bench:     844,215 ns/iter (+/- 18,365)
test sort          ... bench:  62,280,523 ns/iter (+/- 997,028)
test sort_unstable ... bench:  34,822,256 ns/iter (+/- 3,047,204)

Functions

Get the n largest items.
Get the n largest items.
Get the n largest items decided by a key generated by cmp.
Get the n largest items.
Get the n largest items.
Get the n largest items decided by a key generated by cmp.