Optimizing your code for performance ensures your code is getting the most out of what C++ can offer. Unlike other high-level languages, C++ is capable of providing high-level syntactical freedom without sacrificing performance, although admittedly at the expense of a higher learning curve.
This chapter is important because it will demonstrate more advanced methods for optimizing your code, including how to benchmark your software at the unit level, how to examine the resulting assembly code your compiler produces for potential optimizations, how to reduce the number of memory resources your application is using, and why compiler hints such as noexcept are important. After reading this chapter, you will have the skills to write more efficient C++.
In this chapter, we will cover the following recipes:
- Benchmarking your code
- Looking at assembly...