Summary
In this chapter, we covered three methods you can use to profile your code: std::chrono
, micro-benchmarking with the Google Benchmark library, and the Linux perf
tool.
We also saw how to improve multithreaded programs’ performance by both reducing/eliminating false sharing and reducing true sharing, reducing the cache coherency traffic.
This chapter provided a basic introduction to some profiling techniques that will be very useful as a starting point for further studies. As we said at the beginning of this chapter, performance is a complex subject and deserves its own book.