Use unstable sort by key for performance

This commit is contained in:
Evgenii P 2020-12-14 16:27:54 +07:00
parent 641d9554b1
commit 351b656a82
No known key found for this signature in database
GPG Key ID: 46717E4E65912EF7

View File

@ -395,7 +395,7 @@ impl SignersContainer {
/// Returns the list of signers in the container, sorted by lowest to highest `ordering`
pub fn signers(&self) -> Vec<&Arc<dyn Signer>> {
let mut items = self.0.iter().collect::<Vec<_>>();
items.sort_by(|(a, _), (b, _)| (*a).cmp(*b));
items.sort_unstable_by_key(|(key, _)| *key);
items.into_iter().map(|(_, v)| v).collect()
}