Re: Need help with efficiency NXC code
Posted: 22 Aug 2011, 21:26
Instead ofnxtboyiii wrote:But how exactly could I make it not an array of structures?
Code: Select all
map[x][y].p = ...
map[x][y].sld = ...
...
Code: Select all
map_p[x][y] = ...
map_sld[x][y] = ...
...
This is now the point where otimizations start making the code look uglier and harder to maintain! Still, you should follow spillers advice. When you make the map array (or without structures, multiple arrays) global, you should consider using a naming scheme like e.g. this: every global variable starts with "g_". When you don't pass the big array(s) to functions, and the arrays don't contain structs, this will be 2 big optimizations.