C# has some powerful features like fixed
-size buffers, pointers, and unmanaged local variable arrays courtesy of stackalloc
. These are deemed “unsafe” since they all deal with unmanaged memory. We should know what we’re ultimately instructing the CPU to execute when we use these features, so today we’ll take a look at the C++ output from IL2CPP and the assembly output from the C++ compiler to find out just that.
Posts Tagged unsafe
In previous articles I’ve compared the performance of various JSON libraries. Unity’s built-in JsonUtility
usually comes out on top, but that conclusion loses sight of the bigger picture. JsonUtility
is only really fast when you compare it to other JSON libraries. Compared to non-JSON alternatives, it’s ludicrously slow and oversized. Today’s article compares JSON to an alternative format to highlight just how bloated JSON is.
Last week’s article compared the performance of arrays with List<T>
and found List
lacking. This week we’ll optimize both List
and array to maximize performance regardless of which you choose to use.
The series is nearing an end! In today’s article we’ll cover so-called “unsafe” code that gives you unprecedented access to system memory. You can use this to optimize your app or integrate with native (e.g. C, C++) code and APIs. Read on to learn more about this powerful C# tool!