Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This function is really inefficient: Plane::as_data_flatten #119

Open
LetsMelon opened this issue Oct 16, 2023 · 0 comments
Open

This function is really inefficient: Plane::as_data_flatten #119

LetsMelon opened this issue Oct 16, 2023 · 0 comments

Comments

@LetsMelon
Copy link
Owner

pub fn as_data_flatten(&self) -> Vec<u8> {

I think it would be a good idea to replace the current function body with

let total_len = self.data.len() * 4;
let mut result = Vec::with_capacity(total_len);

for p in &self.data {
  result.extend_from_slice(&p.to_raw());
}

result

, but before that the two versions must be bench marked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant