Skip to content

Investigate and probably remove redundant allocation in cast from Rust's Vec to InteropArray #356

@Vixenka

Description

@Vixenka

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,
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions