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

Optimize temporary buffers #41

Open
nemerle opened this issue Feb 5, 2020 · 0 comments
Open

Optimize temporary buffers #41

nemerle opened this issue Feb 5, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@nemerle
Copy link
Collaborator

nemerle commented Feb 5, 2020

Right now there are a few places in the codebase where temporary buffers are created like this:

{
  PODVector<uint8_t> buf;
  buf.resize(REQUIRED_BUFFER_SIZE);
  use_buffer(buf.data(),buf.size());
  // exiting this scope frees the buf memory
}

those should be replaced with slightly faster ( since it skips the memory initialization inherent in vector::resize)

{
  auto buf = eastl::make_unique<uint8_t[]>(REQUIRED_BUFFER_SIZE);
  use_buffer(buf.get(),REQUIRED_BUFFER_SIZE);
  // exiting this scope frees the buf memory
}
@nemerle nemerle added the enhancement New feature or request label Feb 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant