From c0529dc4f28f9ebe837a085a2b0e21d02302446d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Wed, 8 May 2024 19:17:08 +0200 Subject: [PATCH] CommandQueueMT: Pre-allocate memory to avoid a bunch of allocations at startup --- core/templates/command_queue_mt.cpp | 1 + core/templates/command_queue_mt.h | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/core/templates/command_queue_mt.cpp b/core/templates/command_queue_mt.cpp index d9e5e0b2178..ef75a70868e 100644 --- a/core/templates/command_queue_mt.cpp +++ b/core/templates/command_queue_mt.cpp @@ -42,6 +42,7 @@ void CommandQueueMT::unlock() { } CommandQueueMT::CommandQueueMT() { + command_mem.reserve(DEFAULT_COMMAND_MEM_SIZE_KB * 1024); } CommandQueueMT::~CommandQueueMT() { diff --git a/core/templates/command_queue_mt.h b/core/templates/command_queue_mt.h index dbf938a117e..349404d75bd 100644 --- a/core/templates/command_queue_mt.h +++ b/core/templates/command_queue_mt.h @@ -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 command_mem;