Use our new custom std::variant bitsery extension

This prevents reinitializing `std::variant`s when the variant we want to
deserialize is already active. We store audio buffers in variants, so
reinitializing them results in a lot of unnecessary memory frees,
allocations and writes during every processing cycle.
This commit is contained in:
Robbert van der Helm
2021-05-22 17:38:07 +02:00
parent 6ee905c79f
commit 7c49fe739d
7 changed files with 24 additions and 17 deletions
@@ -19,7 +19,7 @@
#include <variant>
#include <bitsery/ext/std_optional.h>
#include <bitsery/ext/std_variant.h>
#include "../../../bitsery/ext/in-place-variant.h"
#include <pluginterfaces/vst/ivstmessage.h>
#include "../../common.h"
@@ -133,7 +133,7 @@ class YaConnectionPoint : public Steinberg::Vst::IConnectionPoint {
void serialize(S& s) {
s.value8b(instance_id);
s.ext(other,
bitsery::ext::StdVariant{
bitsery::ext::InPlaceVariant{
[](S& s, native_size_t& other_instance_id) {
s.value8b(other_instance_id);
},