You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: avoid creating a temporary vec in slice ops mul add (#852)
# Rationale for this change
The `mul_add_assign` module has a `mul_add_assign` function that is only
used by the `MultilinearExtension` `mul_add` function. When calling
`mul_add_assign`, a temporary vector is created with the
`slice_ops::slice_cast(self) call. We don't need to create this
temporary vector. Avoiding this creation will improve performance and
memory allocation.
Before, `24.35ms`

After, `15.72ms`, `1.55x` improvement

# What changes are included in this PR?
- `mul_add_assign` is updated to not require a temporary vector
- The `MultilinearExtension` trait no longer creates a temporary vector
when calling `mul_add_assign`
- Tests are updated to call `mul_add_assign` correctly
# Are these changes tested?
Yes
assert!(result.len() >= to_mul_add.len(),"The length of result must be greater than or equal to the length of the vector of values to be multiplied and added");
0 commit comments