Skip to content

Commit efc0684

Browse files
committed
refactor: Optimize value and weight access in NumericUtils by using unchecked indexing for improved performance
1 parent 2a0eb8e commit efc0684

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

contracts/predictify-hybrid/src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ impl NumericUtils {
289289
let mut sum = 0;
290290
let mut weight_sum = 0;
291291
for i in 0..values.len() {
292-
let v = values[i];
293-
let w = weights[i];
292+
let v = values.get_unchecked(i);
293+
let w = weights.get_unchecked(i);
294294
sum += v * w;
295295
weight_sum += w;
296296
}

0 commit comments

Comments
 (0)