Combine sort keys into u64/u128

This allows the compiler to perform branch-less comparisons, which are
more efficient.

This results in ~5% fewer instructions executed.
This commit is contained in:
Amanieu d'Antras
2022-01-11 10:38:50 +00:00
parent 053375f049
commit d95a9d9399
5 changed files with 44 additions and 10 deletions

View File

@@ -13,7 +13,7 @@
//! Stackmap computation.
use super::{Env, ProgPoint, VRegIndex};
use crate::Function;
use crate::{ion::data_structures::u64_key, Function};
impl<'a, F: Function> Env<'a, F> {
pub fn compute_stackmaps(&mut self) {
@@ -64,7 +64,8 @@ impl<'a, F: Function> Env<'a, F> {
}
}
self.safepoint_slots.sort_unstable();
self.safepoint_slots
.sort_unstable_by_key(|(progpoint, slot)| u64_key(progpoint.to_index(), slot.bits()));
log::trace!("final safepoint slots info: {:?}", self.safepoint_slots);
}
}