perf: use unstable sorting when async

Unstable sorting should be slightly faster than stable sorting, and if
the vector was built asynchronously then preserving the initial order
doesn't matter too much.

Continue to use stable sorting where the vector is not built
asynchronously, or if the vector is partially sorted (e.g. when new
elements are pushed to a sorted vector).
This commit is contained in:
Cheong Lau 2025-10-07 21:50:08 +10:00 committed by Michael Murphy
parent dd0158d8f0
commit 38c037c977
5 changed files with 6 additions and 6 deletions

View file

@ -171,7 +171,7 @@ impl State {
filter_firefox_players(&mut players);
// pre-sort by path so that the same player is always selected
players.sort_by(|a, b| a.name().cmp(b.name()));
players.sort_unstable_by(|a, b| a.name().cmp(b.name()));
let mut state = Self {
conn,