Thanks for the details and the links! I definitely am aware of the drawbacks of the GC (no pun intended with your name), and once I get more of the module implementation working I will do a basic real-time implementation to see how much of a problem GC would be.
Currently the plugin.dll I’m creating is native AOT compiled. There are general incompatibilities and trimming issues with creating such single-file deployments, but it’s not hard to avoid most of those incompatibilities, especially if you bring code-gen tooling into the picture.
When it comes to GC, the first thing that comes to my head is the LOH (large-object heap), which is allocated to when an object passes 84KB I think. With such computationally-intensive processes as DSP, I’d imagine most of what we operate with are lighter data structures, like primitive data types and small structs, which are easy to keep off the LOH.
If you’re worried about too many hurdles on the DSP threads, I’d like to add that it’s really easy to program multithreaded code in C# if you know what you’re doing, which can be a huge bonus in performance (maybe have a separate thread that manages larger objects, if you really need them).
Also, I personally haven’t used these much, but System.Numerics and System.Runtime.Intrinsics are supported in native AOT as well (.NET 8 or later), which means you can bring beefed-up hardware computation to C# with relative ease. Again, this isn’t anything C++ or C can’t do, but it’s a great plus for C# to have it as well.
A lot of this awesome compatibility and ahead of time compilation is relatively new in .NET though, as .NET 8 introduced many new features for AOT native compilation. .NET 9 will come out in November (only two months away, but I’m using release candidates regularly), and I’ll be on the look out for new improvements.
Thanks for this awesome feedback! I’ll keep you all updated on progress I make towards a minimal plugin reproduction.