SegsEngine icon indicating copy to clipboard operation
SegsEngine copied to clipboard

Optimize temporary buffers

Open nemerle opened this issue 6 years ago • 0 comments

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 avatar Feb 05 '20 13:02 nemerle