In this chapter, we have covered many topics related to Swift performance. First we need to understand what we need to improve and enable optimization settings to get the best performance.
Memory usage is very important for achieving high performance. First, we covered how using constants can have a positive impact on performance. The second and more important example reflects how using value types and structures reduces memory usage and also improves performance by using fast stack memory.
The third important topic we have covered is dispatching methods. We have analyzed and compared both Objective-C dynamic dispatch and Swift static dispatch. By looking at the assembly code we have seen how Swift actually performs method dispatch and how it can benefit performance.
We have also covered some dangerous operations that could decrease performance and that should be avoided.
In the next chapter, we will learn more about different data structures: their differences and performance characteristics...