3 ms·
>If .NET (using C#) can produce a native binary I'll switch to that for as many projects as I can. We've been compiling our large C# games to native code for s
by Coincoin 9y ago
>If .NET (using C#) can produce a native binary I'll switch to that for as many projects as I can.
We've been compiling our large C# games to native code for some years now because iOS only supports signed code. The main problem is you can never JIT; this creates all sorts of limitations with generics, dynamics, expressions and reflection.
Xamarin has become better and better at handling generics but there are still a couple of things they just can't do anything about.
>Memory
Yes, the memory looks bad because it will not get completely collected until needed. The framework code is big, but that's a flat cost. It might take a little more memory for the runtime up keeping, but it is not 10x. However, memory profiling is a breeze compared to native, so it becomes easier to optimize on a large complicated project.
>Performance
If you don't want to bound check there are a lot of solutions, from simple to advanced. Most of the time we end up just iterating the whole array anyway, and in those case, there are no bound checks.
In the rare case where we really need raw power (graphics, path finding, physics, large file access), we use native code and thin wrap it with P/Invokes.
- srean 9y agoCurious if you deal with a lot of float32 math (the usual sin cos log tanh) and if so what do you use.
- Coincoin 9y agoFor the heavy lifting such as scene transformations and animations we delegate in batches to a SIMD optimized native lib. For the rest, we use System.Math. They are not used enough to be a significant bottleneck.