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
@@ -74,7 +74,8 @@ intptr_t DefaultDataConverter::return_value(const int /*opcode*/,
Vst2EventResult DefaultDataConverter::send_event(
boost::asio::local::stream_protocol::socket& socket,
const Vst2Event& event) const {
write_object(socket, event);
return read_object<Vst2EventResult>(socket);
const Vst2Event& event,
SerializationBufferBase& buffer) const {
write_object(socket, event, buffer);
return read_object<Vst2EventResult>(socket, buffer);
}