Performance measurement tools
To learn about the performance of our applications, we need to be able to measure it. If there’s one key takeaway from this chapter, it’s to never estimate or guess your code performance. To know whether your program meets its performance requirements (either latency or throughput), you need to measure, measure, and then measure again.
Once you have the data from your performance tests, you’ll know the hotspots in your code. Maybe they’re related to memory access patterns or thread contention (such as, for example, when multiple threads must wait to acquire a lock to access a resource). This is where the second most important takeaway comes into play: set a goal when optimizing your application. Don’t aim to achieve the best performance possible because there always will be room for improvement. The right thing to do is to set a clear specification with targets such as maximum processing time for a transaction or the...