Something got through my mind lately, while developing my server framework resource in C# :
Is it faster (performance-wise) and/or more efficient (memory-wise) to have multiple small C# resources handling specific features, or one big C# resource containing everything needed ?
I’m talking about C# DLL only and not about LUA (which seems to be faster in some cases).
I read somewhere that there is some overhead added with AppDomain in C# but there’s also the Garbage Collector running and such.
I’ve a few scripts running but I was wondering if I’m doing it right.
So far, my one dll “framework” runs at ~1.00ms with ~3.7Mb used.
Most scripts use C# Tasks onTick, mainly to display blips and markers.
The same scripts split in two different resources seems to eat around twice as much CPU time and around 1.7x more memory.
I have shared files (entities or helper functions) in every resources, they don’t have OnTick (they don’t even inherit from BaseScript)
Obviously, including the same sources in multiple DLL split in multiple resources would cause duplicate, explaining the increased memory usage.
With those tests, it seems far more efficient to regroup everything in one resource.
But I’m not sure I tested that correctly so I’m asking the community about some feedback on that