Skip to content

Commit b7ac1e8

Browse files
Oppenpefontana
andauthored
perf: avoid iterators for keeping rc limits (#1316)
Co-authored-by: Pedro Fontana <[email protected]>
1 parent d0d6d90 commit b7ac1e8

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#### Upcoming Changes
44

5+
* perf: remove pointless iterator from rc limits tracking [#1316](https://github.com/lambdaclass/cairo-vm/pull/1316)
6+
57
#### [0.8.2] - 2023-7-10
68

79
* chore: update dependencies, particularly lamdaworks 0.1.2 -> 0.1.3 [#1323](https://github.com/lambdaclass/cairo-vm/pull/1323)
@@ -10,6 +12,7 @@
1012

1113
* feat: add dependency installation script `install.sh` [#1298](https://github.com/lambdaclass/cairo-vm/pull/1298)
1214

15+
1316
* fix: specify resolver version 2 in the virtual workspace's manifest [#1311](https://github.com/lambdaclass/cairo-vm/pull/1311)
1417

1518
* feat: add `lambdaworks-felt` feature to `cairo-vm-cli` [#1308](https://github.com/lambdaclass/cairo-vm/pull/1308)

vm/src/vm/vm_core.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -405,15 +405,10 @@ impl VirtualMachine {
405405
instruction.off1 + (1_isize << (OFFSET_BITS - 1)),
406406
instruction.off2 + (1_isize << (OFFSET_BITS - 1)),
407407
);
408+
let (min, max) = self.rc_limits.unwrap_or((off0, off0));
408409
self.rc_limits = Some((
409-
[self.rc_limits.unwrap_or((off0, off0)).0, off0, off1, off2]
410-
.into_iter()
411-
.min()
412-
.unwrap(),
413-
[self.rc_limits.unwrap_or((off0, off0)).1, off0, off1, off2]
414-
.into_iter()
415-
.max()
416-
.unwrap(),
410+
min.min(off0).min(off1).min(off2),
411+
max.max(off0).max(off1).max(off2),
417412
));
418413

419414
self.segments

0 commit comments

Comments
 (0)