Skip to content

Commit

Permalink
Merge pull request #91727 from RandomShaper/cmd_queue_prealloc
Browse files Browse the repository at this point in the history
`CommandQueueMT`: Pre-allocate memory to avoid a bunch of allocations at startup
  • Loading branch information
akien-mga committed May 10, 2024
2 parents 7704457 + c0529dc commit e6780b5
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 e6780b5

Please sign in to comment.