Make sure effProcessEvents() also never allocates

This basically changes the default small vectors during VST2 event
processing from 256 bytes to the size of a `DynamicVstEvents`
object (which also includes a small_vector to hold MIDI events without
allocating) and makes them thread local. We already have a similar
optimization for VST3. There it's a bit neater since we already had to
separate audio processing functions from non-time critical functions.
Here we don't have that separation, so we just made these buffers thread
local, large enough to hold our predefined number of events, and we then
just shrink them to fit if these buffers grow even more (which can only
happen after reading or writing chunk data).

The change doesn't specifically target `effProcessEvents()`, but that's
where you would see the differences. This is also relevant for
`audioMasterProcessEvents()`.
This commit is contained in:
Robbert van der Helm
2021-05-23 17:37:09 +02:00
parent 77d43e4f08
commit 0b9b1330ad
4 changed files with 48 additions and 14 deletions
+4 -3
View File
@@ -621,13 +621,14 @@ class HostCallbackDataConverter : public DefaultDataConverter {
Vst2EventResult send_event(
boost::asio::local::stream_protocol::socket& socket,
const Vst2Event& event) const override {
const Vst2Event& event,
SerializationBufferBase& buffer) const override {
if (mutually_recursive_callbacks.contains(event.opcode)) {
return mutual_recursion.fork([&]() {
return DefaultDataConverter::send_event(socket, event);
return DefaultDataConverter::send_event(socket, event, buffer);
});
} else {
return DefaultDataConverter::send_event(socket, event);
return DefaultDataConverter::send_event(socket, event, buffer);
}
}