One of the most common reasons to choose C++ as a key programming language for a project is due to performance requirements. C++ has a clear edge over the competition when it comes to performance, but achieving the best results requires understanding relevant problems. This chapter focuses on increasing the performance of C++ software. We'll start by showing you tools for measuring performance. We'll show you a few techniques for increasing single-threaded compute speed. Then we'll discuss how to make use of parallel computing. Finally, we'll show how you can use C++20's coroutines for non-preemptive multitasking.
The following topics will be covered in this chapter:
- Measuring performance
- Helping the compiler generate performant code
- Parallelizing computations
- Using coroutines
First, let's specify what you'll need to run the examples...