Optimization through Patterns
In this last chapter, we are going to discuss the last thing we should think about before releasing our games: optimization. Optimization patterns are designed to leave our code functioning as it was before but in a faster, more elegant way that impacts our hardware less. This chapter is quite wordy, but the underlying principles that guide these patterns require a certain understanding of how the hardware resources at our disposal work. By the end, we will have covered everything from how to help the CPU do its job better to making a system you can plug into any game to make it potentially faster at runtime.
The patterns making this possible are the following:
- Dirty Flag, which focuses on reducing the number of times we need to update calculated values.
- Data Locality, which concerns optimizing the code layout to work with the way the CPU’s memory works. As a description, this sounds much more complicated than the reality of the application...