Optimizing Performance On The Xbox 360 - Part 2
In part 1 I described the reasons why Xbox 360 is slower than an equivalent PC and some of the basic recommendations for optimizing C# code to make it run faster. In this post I will mention a few other tricks to increase performance on the Xbox 360. Structures… again. In the .NET world, objects are allocated on the heap and structures are allocated on the stack. Remember, only the heap is garbage collected, this means that structures are not subject to the expensive garbage collection operation. Allocation on the stack is basically free as we only need to increase a stack pointer and call a constructor. This means you can reduce garbage collection and increase speed by using structures instead of objects – however, you need to know the difference between the two. You should also follow the general recommendations for using structures: Small data objects (data containers) Often destroyed or created Read-only (or mostly-read) objects Reuse those objects As m...