summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2024-05-08 19:17:08 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2024-05-09 11:51:07 +0200
commitc0529dc4f28f9ebe837a085a2b0e21d02302446d (patch)
tree73ba87a1717653f403d9dd370302a09c21d492ea /core
parentc4279fe3e0b27d0f40857c00eece7324a967285f (diff)
downloadredot-engine-c0529dc4f28f9ebe837a085a2b0e21d02302446d.tar.gz
CommandQueueMT: Pre-allocate memory to avoid a bunch of allocations at startup
Diffstat (limited to 'core')
-rw-r--r--core/templates/command_queue_mt.cpp1
-rw-r--r--core/templates/command_queue_mt.h4
2 files changed, 2 insertions, 3 deletions
diff --git a/core/templates/command_queue_mt.cpp b/core/templates/command_queue_mt.cpp
index d9e5e0b217..ef75a70868 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 dbf938a117..349404d75b 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<uint8_t> command_mem;