From 77d43e4f0818cf8e8fdb9d6dd56b95e19e43d047 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 23 May 2021 16:44:34 +0200 Subject: [PATCH] Increase the default serialization buffer size Setting VST2 plugin parameters would sometimes result in allocations. --- src/common/communication/common.h | 8 ++++---- src/common/communication/vst3.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/common/communication/common.h b/src/common/communication/common.h index 475eebee..3f9a8114 100644 --- a/src/common/communication/common.h +++ b/src/common/communication/common.h @@ -163,7 +163,7 @@ inline void write_object(Socket& socket, */ template inline void write_object(Socket& socket, const T& object) { - SerializationBuffer<64> buffer{}; + SerializationBuffer<256> buffer{}; write_object(socket, object, buffer); } @@ -238,7 +238,7 @@ inline T read_object(Socket& socket, SerializationBufferBase& buffer) { */ template inline T& read_object(Socket& socket, T& object) { - SerializationBuffer<64> buffer{}; + SerializationBuffer<256> buffer{}; return read_object(socket, object, buffer); } @@ -251,7 +251,7 @@ inline T& read_object(Socket& socket, T& object) { template inline T read_object(Socket& socket) { T object; - SerializationBuffer<64> buffer{}; + SerializationBuffer<256> buffer{}; read_object(socket, object, buffer); return object; @@ -504,7 +504,7 @@ class SocketHandler { */ template F> void receive_multi(F&& callback) { - SerializationBuffer<64> buffer{}; + SerializationBuffer<256> buffer{}; T object; while (true) { try { diff --git a/src/common/communication/vst3.h b/src/common/communication/vst3.h index bd6ab66b..da139e75 100644 --- a/src/common/communication/vst3.h +++ b/src/common/communication/vst3.h @@ -161,7 +161,7 @@ class Vst3MessageHandler : public AdHocSocketHandler { const T& object, typename T::Response& response_object, std::optional> logging) { - SerializationBuffer<64> buffer{}; + SerializationBuffer<256> buffer{}; return receive_into(object, response_object, std::move(logging), buffer); } @@ -217,7 +217,7 @@ class Vst3MessageHandler : public AdHocSocketHandler { // every time, but on the audio processor side we store the // actual variant within an object and we then use some hackery // to always keep the large process data object in memory. - thread_local SerializationBuffer<64> persistent_buffer{}; + thread_local SerializationBuffer<256> persistent_buffer{}; thread_local Request persistent_object; auto& request = @@ -506,7 +506,7 @@ class Vst3Sockets : public Sockets { typename T::Response& response_object, size_t instance_id, std::optional> logging) { - thread_local SerializationBuffer<64> audio_processor_buffer{}; + thread_local SerializationBuffer<256> audio_processor_buffer{}; return audio_processor_sockets.at(instance_id) .receive_into(object, response_object, logging,