mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 20:10:13 +02:00
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:
@@ -36,6 +36,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
unions yabridge uses to differentiate between single and double precision
|
||||
floating point audio buffers, undoing all of our efforts at reusing objects
|
||||
and preventing memory allocations in the process.
|
||||
- Further optimized VST3 audio processing by preallocating small vectors for
|
||||
event and parameter change queues.
|
||||
- Changed the way mutual recursion in VST3 plugins on the plugin side works to
|
||||
counter any potential GUI related timing issues with VST3 plugins.
|
||||
- The deserialization part of yabridge's communication is now slightly faster by
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../bitsery/ext/in-place-variant.h"
|
||||
#include <pluginterfaces/vst/ivstevents.h>
|
||||
#include <boost/container/small_vector.hpp>
|
||||
|
||||
#include "../../bitsery/ext/in-place-variant.h"
|
||||
#include "base.h"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
@@ -259,13 +260,14 @@ class YaEventList : public Steinberg::Vst::IEventList {
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<YaEvent> events;
|
||||
boost::container::small_vector<YaEvent, 32> events;
|
||||
|
||||
/**
|
||||
* On the first `getEvent()` call we'll reconstruct these from `events` all
|
||||
* at once. These event objects may not outlive this event list.
|
||||
*/
|
||||
std::vector<Steinberg::Vst::Event> reconstructed_events;
|
||||
boost::container::small_vector<Steinberg::Vst::Event, 32>
|
||||
reconstructed_events;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <bitsery/traits/vector.h>
|
||||
#include <pluginterfaces/vst/ivstparameterchanges.h>
|
||||
#include <boost/container/small_vector.hpp>
|
||||
|
||||
#include "../../bitsery/traits/small-vector.h"
|
||||
#include "base.h"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
@@ -95,7 +96,9 @@ class YaParamValueQueue : public Steinberg::Vst::IParamValueQueue {
|
||||
*
|
||||
* This contains pairs of `(sample_offset, value)`.
|
||||
*/
|
||||
std::vector<std::pair<int32, Steinberg::Vst::ParamValue>> queue;
|
||||
boost::container::small_vector<std::pair<int32, Steinberg::Vst::ParamValue>,
|
||||
16>
|
||||
queue;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user