1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 16:31:42 +00:00

Attempt to reduce memory allocations.

This commit is contained in:
Thomas Harte 2022-07-13 21:41:04 -04:00
parent 92efad4970
commit 79f8cab5e2

View File

@ -89,6 +89,7 @@ DeferringAsyncTaskQueue::~DeferringAsyncTaskQueue() {
void DeferringAsyncTaskQueue::defer(std::function<void(void)> function) { void DeferringAsyncTaskQueue::defer(std::function<void(void)> function) {
if(!deferred_tasks_) { if(!deferred_tasks_) {
deferred_tasks_ = std::make_unique<TaskList>(); deferred_tasks_ = std::make_unique<TaskList>();
deferred_tasks_->reserve(16);
} }
deferred_tasks_->push_back(function); deferred_tasks_->push_back(function);
} }