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:   1,000,216 ns/iter (+/- 41,060)
test max_unstable  ... bench:     997,303 ns/iter (+/- 36,817)
test sort          ... bench:  61,034,315 ns/iter (+/- 1,042,745)
test sort_unstable ... bench:  30,451,385 ns/iter (+/- 289,475)

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.