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 max           ... bench:   5,483,288 ns/iter (+/- 231,299)
test max_unstable  ... bench:   5,462,940 ns/iter (+/- 139,545)
test sort          ... bench:  67,729,867 ns/iter (+/- 2,045,393)
test sort_unstable ... bench:  35,710,133 ns/iter (+/- 983,608)

Functions

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