From 92177c96652604c306c608b21282bc747903d235 Mon Sep 17 00:00:00 2001 From: Mario Rugiero Date: Tue, 4 Jul 2023 18:33:30 -0300 Subject: [PATCH] perf: avoid iterators for keeping rc limits --- vm/src/vm/vm_core.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/vm/src/vm/vm_core.rs b/vm/src/vm/vm_core.rs index c34244308c..f11c949714 100644 --- a/vm/src/vm/vm_core.rs +++ b/vm/src/vm/vm_core.rs @@ -405,15 +405,10 @@ impl VirtualMachine { instruction.off1 + (1_isize << (OFFSET_BITS - 1)), instruction.off2 + (1_isize << (OFFSET_BITS - 1)), ); + let (min, max) = self.rc_limits.unwrap_or((off0, off0)); self.rc_limits = Some(( - [self.rc_limits.unwrap_or((off0, off0)).0, off0, off1, off2] - .into_iter() - .min() - .unwrap(), - [self.rc_limits.unwrap_or((off0, off0)).1, off0, off1, off2] - .into_iter() - .max() - .unwrap(), + min.min(off0).min(off1).min(off2), + max.max(off0).max(off1).max(off2), )); self.segments