SegsEngine
SegsEngine copied to clipboard
Optimize temporary buffers
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
}