I started a VST3 virtual instrument plugin in Kotlin/native. Unfortunately, I'm facing major performance issues. The DAW's CPU usage indicator clearly shows my plugin uses way too much CPU. Even though some of my code could be optimised a bit (e.g. lookup tables instead of computing all waveforms ad hoc), I'm baffled at how much CPU the plugin is using while still a lot of the features haven't even been implemented yet. I suspect Kotlin/native's memory management might be the problem, because there are bursts of performance drops that might be caused by the GC. I tried to avoid creating unnecessary objects, even avoiding lambdas and iterators. I'm a bit at a loss what I could try next. Any suggestions? If you want to have a look at the source code, here's the Github project:
https://github.com/digorydoo/kangaroo The core is in /src/nativeMain/kotlin/ch/digorydoo/kangaroo/audio/AudioProcessor.kt, onProcessBlock.