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:
parent
dd0158d8f0
commit
38c037c977
5 changed files with 6 additions and 6 deletions
|
|
@ -808,6 +808,6 @@ async fn build_device_list(mut devices: Vec<BluerDevice>, adapter: &Adapter) ->
|
|||
devices.push(device);
|
||||
}
|
||||
|
||||
devices.sort();
|
||||
devices.sort_unstable();
|
||||
devices
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue