Skip to content

Commit

Permalink
CommandQueueMT: Pre-allocate memory to avoid a bunch of allocations a…
Browse files Browse the repository at this point in the history
…t startup
  • Loading branch information
RandomShaper committed May 9, 2024
1 parent c4279fe commit c0529dc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions core/templates/command_queue_mt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void CommandQueueMT::unlock() {
}

CommandQueueMT::CommandQueueMT() {
command_mem.reserve(DEFAULT_COMMAND_MEM_SIZE_KB * 1024);
}

CommandQueueMT::~CommandQueueMT() {
Expand Down
4 changes: 1 addition & 3 deletions core/templates/command_queue_mt.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,7 @@ class CommandQueueMT {

/***** BASE *******/

enum {
DEFAULT_COMMAND_MEM_SIZE_KB = 256,
};
static const uint32_t DEFAULT_COMMAND_MEM_SIZE_KB = 64;

BinaryMutex mutex;
LocalVector<uint8_t> command_mem;
Expand Down

0 comments on commit c0529dc

Please sign in to comment.