From 573a5c63cf6226f6ea856452dcee38b909ef2cc5 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 8 Oct 2020 15:33:26 +0100 Subject: [PATCH] hypervisor: kvm: Use unstable_sort() to keep clippy happy "Using a stable sort consumes more memory and cpu cycles. Because values which compare equal are identical, preserving their relative order (the guarantee that a stable sort provides) means nothing, while the extra costs still apply." Signed-off-by: Rob Bradford --- hypervisor/src/kvm/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hypervisor/src/kvm/mod.rs b/hypervisor/src/kvm/mod.rs index f94f2cf2d..d818ec7c6 100644 --- a/hypervisor/src/kvm/mod.rs +++ b/hypervisor/src/kvm/mod.rs @@ -1029,7 +1029,7 @@ impl cpu::Vcpu for KvmVcpu { // we can calculate the id based on the offset in the structure. reg_list.retain(|regid| *regid != 0); - reg_list.as_slice().to_vec().sort(); + reg_list.as_slice().to_vec().sort_unstable(); reg_list.retain(|regid| is_system_register(*regid));