Preallocate small vectors for VST3 queues

Events, parameter changes, and the individual queues contained within
the parameter changes all use dynamic memory allocation. Preallocating
some memory for those things inside of the objects may prevent latency
spikes when they those objects are first filled. This is especially
useful for the parameter changes since there's no way to reserve memory
in a vector of vectors.
This commit is contained in:
Robbert van der Helm
2021-05-22 23:38:31 +02:00
parent 90338abe6d
commit da8f4aae19
4 changed files with 15 additions and 6 deletions
@@ -17,7 +17,9 @@
#pragma once
#include <pluginterfaces/vst/ivstparameterchanges.h>
#include <boost/container/small_vector.hpp>
#include "../../bitsery/traits/small-vector.h"
#include "base.h"
#include "param-value-queue.h"
@@ -83,7 +85,7 @@ class YaParameterChanges : public Steinberg::Vst::IParameterChanges {
/**
* The parameter value changes queues.
*/
std::vector<YaParamValueQueue> queues;
boost::container::small_vector<YaParamValueQueue, 16> queues;
};
#pragma GCC diagnostic pop