This vec.shrink_to_fit(); function looks like redundant allocation which affects performance. Probably should be removed, because InteropArray currently never is used (and never should be used) for storing data and it is only for data transfer between managed and unmanaged,
|
fn from(mut vec: Vec<T>) -> InteropArray<T> { |
|
vec.shrink_to_fit(); |
|
let ptr = vec.as_mut_ptr(); |
|
let length = vec.len() as i32; |
|
mem::forget(vec); |
|
|
|
InteropArray { |
|
ptr: ptr as *mut T, |
|
length, |
|
} |
|
} |
This
vec.shrink_to_fit();function looks like redundant allocation which affects performance. Probably should be removed, becauseInteropArraycurrently never is used (and never should be used) for storing data and it is only for data transfer between managed and unmanaged,NoiseEngine/NoiseEngine.Native/src/interop/interop_array.rs
Lines 51 to 61 in 98d8bfa