From d95d65c6a31aa908ff72ddaf1fcf5dea58493f9b Mon Sep 17 00:00:00 2001 From: Xymist Date: Fri, 26 Aug 2022 16:36:34 +0100 Subject: [PATCH] Use Rayon for sorting as well - For completeness, but also for additional performance when there are extremely large numbers of results, use `par_sort_unstable_by()` for sorting the results. For most sane result sets this will not represent a significant speedup (for the Kubernetes benchmark it's around 1%) but as the set to be sorted grows the impact would be larger. --- rust/sorter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/sorter.rs b/rust/sorter.rs index 71d2efa..3cce282 100644 --- a/rust/sorter.rs +++ b/rust/sorter.rs @@ -31,6 +31,6 @@ pub fn sort_strings(options: Options, strings: Vec) -> Vec { }) .filter(|m| m.score > 25) .collect::>(); - matches.sort_by(|a, b| a.score.cmp(&b.score)); + matches.par_sort_unstable_by(|a, b| a.score.cmp(&b.score)); matches }