meilisearch / grenad

Tools to sort, merge, write, and read immutable key-value pairs :tomato:
https://docs.rs/grenad
MIT License
25 stars 3 forks source link

Optionally use an unstable sort algorithm for the Sorter #34

Closed loiclec closed 2 years ago

loiclec commented 2 years ago

Pull Request

What does this PR do?

The SorterBuilder now accepts a SortAlgorithm argument, which can be either Stable and Unstable. This value determines whether the entries in the internal vector are sorted using .sort_by_key or .sort_unstable_by_key. Stable sort is the default and keeps the relative order of values with equal keys. Unstable sort is free to rearrange the values in any order, but it is faster, sometimes significantly so.