Trying out IL2CPP on android I have found it can nearly double the speed for complex code (poly triangulation) which is great, well done Unity!
But of course I want my inner loops to be even faster so are there any manual optimisations that still apply to how I write my C# code like avoiding function calls (putting the code inline instead) that will be useful to always keep in mind?
I would stick to writing good C# code, e.g avoid GC allocations. IL2CPP should not make any good C# code bad. In addition, you can tell IL2CPP to not emit array bounds check or null reference exception checks in certain code: Unity - Manual: IL2CPP Overview
I would profile anything you do in this respect though, as turning these off can lead to crashes that are difficult to detect. So make sure the performance difference is worth the lack of safety.
1 Like