Download Game Physics

Transcript
Optimization techniques
• Size does matter
– To compile arrays of structures, the compiler performs a
multiplication by the size to create the array indexing
• if the structure size is a power of 2, the multiplication is replaced
by a shift operation (much faster)
• you can round array sizes aligned to a power of 2 even if you do
not use all of it
– Example
int softBodyNodes [38];
int softBodyNodes [64]; // faster allocation
Game Physics
41