Do small vector optimization for all communication

I once read years ago somewhere on Stack Overflow that `std::vectors`
with that are preinitialized to a default size would allocate the
initial capacity on the stack. This of course doesn't make any
sense (run time sized stack allocations can cause all kinds of issues),
so we were still allocating with our default 64-byte sized buffers, but
just not as often.
This commit is contained in:
Robbert van der Helm
2021-05-23 14:43:02 +02:00
parent a5ba3bdf33
commit 6f321649c4
6 changed files with 96 additions and 27 deletions
+1 -1
View File
@@ -593,7 +593,7 @@ void Vst2PluginBridge::do_process(T** inputs, T** outputs, int sample_frames) {
}
// The inputs and outputs arrays should be `[num_inputs][sample_frames]` and
// `[num_outputs][sample_frames]` floats large respectfully.
// `[num_outputs][sample_frames]` floats large respectfully
std::vector<std::vector<T>> input_buffers(plugin.numInputs,
std::vector<T>(sample_frames));
for (int channel = 0; channel < plugin.numInputs; channel++) {